Answers for "check id exist or not in jquery"

4

jquery test div exists

$(document).ready(function() {
    var $myDiv = $('#DivID');

    if ( $myDiv.length){
        //you can now reuse  $myDiv here, without having to select it again.
    }


});
Posted by: Guest on March-27-2020
10

check element exist in jquery

if ($('.element').length) {
  // there is at least one element matching the selector
}
Posted by: Guest on May-16-2020

Code answers related to "check id exist or not in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language