c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JQuery

How to check id is exists or not using jQuery?

| | JQuery

In this article, I will show you
how to check the element id is exists or not using jQuery. It probably will
help in dynamic generated HTML elements, this simple example, check whether the
id is there or not like this, 

<script type="text/javascript">

function savecomment() {

if ($("#txtcomment").attr("id")) {

         // ...           

 } else {

         // ...

        }

}

</script>
<textarea name='textarea1' id='txtcomment' placeholder='Add acomment...' autocomplete='off'
required='required' class='form-control custom-control' rows='3' style='resize:none'>
</
textarea> 

check id is exists or not using jQuery