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 |
What is the purpose of fadetoggle() method in jquery?
Explain finish method in jquery? : jquery mobile
Is it possible to use our own specific character in the place of $ sign in jquery? : jquery mobile
How can you use array with jquery?
What is the difference between onload() and document.ready() function used in jquery?
How can I select 20th div with jquery?
How to get the direct parent of an element using ?
What is the use of toggle() method in jquery?
Is jquery a w3c standard? : jquery mobile
What is difference between $(this) and ‘this’ in jquery?
Explain cdn in jquery?
Does jquery 2.0 supports ie? : jquery mobile