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 advantage of using protocol less URL while referencing jQuery from CDNs?
How to use migrate jquery plugin if possible? : jquery mobile
What is the difference between parent() and parents() methods in jQuery?
Mention the differences between javascript and jquery.
What is each() function in jQuery? How do you use it?
How do I check if the DOM is ready?
What is the name of jquery method used for an asynchronous http request?
Tell me is jquery a library for client scripting or server scripting? : jquery mobile
How can jquery library be added to pages?
What are the different type of selectors in jquery?
What are the advantage of using cdn? : jquery mobile
Tell me how to executed jquery selectors? : jquery mobile