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 |
explain width() vs css(‘width’) in jquery
What is the use of css() method in jquery?
How to programmatically trigger a click event that's being handled by jquery?
How does the jQuery pushStack function work?
What features of jquery, has been used in web applications?
What is the use of toggle() method in jquery?
How to multiple version of jQuery?
Why jQuery is better than JavaScript?
What is difference between prop and attr?
How does caching helps and how to use caching in jQuery?
Write a code for the implementation of a module pattern.
Is it possible to get value of multiple CSS properties in single statement?