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 jquery.noconflict? : jquery mobile
Explain various methods to make ajax request in jquery?
How to get/set the html contents of an element using jQuery?
Why is not dom ready working for jquery mobile? : jquery mobile
Can we have multiple document.ready() function on the same page? : jquery mobile
What does dollar sign ($) me in jquery?
Is it possible that jquery html work for both html and xml document?
What are the different types of selectors?
How To Use Ajax In Jquery?
Why use jQuery filter() Methods?
What are two different version of jquery library? : jquery mobile
What is the between $(this) and 'this' in jquery?
How to disable/enable an element with jQuery?
Difference between document.ready() and body onload()?
How we can hide a block of html code on a button click using jquery?