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 |
How do I pull a native DOM element from a jQuery object?
Explain the difference between .js and .min.js?
Is jquery is json library file or a javascript?
Which one is more efficient, document.getElementbyId( "myId") or $("#myId)?
How to check if number is numeric while using jQuery 1.7+?
When can you use jquery?
How JavaScript and jQuery are different?
What is jquery a client or server scripting?
What is the use of queue() in jquery?
Explain slidetoggle() effect.
Do you have plans for a new jquery plug-in or something else we should look out for? Where to from here for the imgpreview plugin?
What is the purpose of jquery?