How do you check if an element exists or not in jQuery?



How do you check if an element exists or not in jQuery?..

Answer / chaitanya

Using jQuery length property, we can ensure whether element exists or not.

Hide Copy Code

$(document).ready(function(){

if ($('#element').length > 0){

//Element exists

}

});

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

What is a filter in jquery? Explain

0 Answers  


Mention some advantages of jquery.

0 Answers  


What are the features of jQuery, has been used in web applications?

0 Answers  


What is the use of each function in jQuery?

0 Answers  


Explain url paremeter of jquery ajax method?

0 Answers  






What is the difference between onload() and document.ready() function used in jquery?

0 Answers  


Explain the features of jquery mobile? : jquery mobile

0 Answers  


Can you use any other name in place of $ (dollar sign) in jQuery?

0 Answers  


What does dollar sign ($) means in jquery? : jquery mobile

0 Answers  


Is jQuery a W3C standard?

2 Answers  


What is $('div')? : jquery mobile

0 Answers  


Which command will give a version of jQuery?

0 Answers  


Categories