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
How to submit a form without submit button using jquery?
How can we apply css in div using jquery?
What happen if you return false from a jQuery event handler?
How do you select an item using css class or id and get the value by use of jquery.
Explain .live()? : jquery mobile
How to find grand children in of an element?
What is the use of jQuery filter?
How to validate email using jquery?
Can you please explain the difference between event.preventdefault and "return false"? : jquery mobile
Do you know what is the use of jquery.data()?
How can you get the type of arguments passed to a function?
Explain the each() function?
Is jquery library used for server scripting or client scripting?
What is jquery.noconflict? Explain
Explain the use of data-role=”page” attribute? : jQuery Mobile