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 add and remove css classes to an element using jquery?
Which program is useful for testing jQuery?
How we can remove an attribute of an html tag in jquery?
Please explain remove class jquery with example?
Explain the difference between jquery's ready and holdready?
Explain chaining in jquery? : jquery mobile
What are the advantages of minified version of jquery?
Difference between javascript and jquery? : jQuery Mobile
Mac, windows or linux? Why do you love this platform while using jquery?
Explain is jquery replacement of java script? : jquery mobile
How you get server response from an ajax request using jquery?
Difference Between Prop and Attr in jQuery?
what is the use of param() method in jquery .
How to Use the jQuery load() Method?
How to programmatically trigger a click event that's being handled by jquery?