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 how jquery works?
Explain cdn in jquery?
Is Uncaught TypeError: $(…).modal not a function jquery?
Define the types of selectors in jquery?
Why we use jquery .each() function?
How to add and remove css classes to an element using ?
Define animate function in jquery?
How can events be prevented to work after an ajax request?
How to find all sibling elements after the current element using ?
What is the difference between find and children methods in jquery?
Why is not dom ready working for jquery mobile? : jquery mobile
Can you use multiple document.ready() function on the same page?