How do you check if an element exists or not in jQuery?
Answer Posted / 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 View All Answers
Explain the use of the .pushstack() method.
How We Can Write Code Specific To Browser In Jquery?
How To Use Ajax In Jquery?
What are the four parameters used for jQuery Ajax method?
What happen if you return false from a jQuery event handler?
What is the difference between $.map and $.grep in jQuery?
Have any of your startup projects failed dismally - if so, why and how did you learn from them?
Explain which program is useful for testing jquery?
Define cache paremeter of jquery ajax method?
Explain the concepts of "$ function" in jquery with an example?
Different ways of using $.connect function in jquery?
What is the difference between jquery and javascript?
what are the features of jquery
How can jquery be used in conjunction with another javascript library that also uses $ for naming?
What are some of the ways to provide effects? : jQuery Mobile