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
Which are the fastest selectors in jquery? : jquery mobile
How can we include jQuery library in ASP.Net project?
Explain various methods to make ajax request in jquery?
Explain .empty() vs .remove() vs .detach().
What are the features of jquery used in web applications?
What does $("P") will select?
What are two different version of jquery library? : jquery mobile
List the basic selectors in jquery?
What does dollar sign ($) me in jquery?
Explain the difference between onload() and document.ready() function used in jquery?
Explain each() function in jquery?
Is Uncaught TypeError: $(…).modal not a function jquery?
What are the different ways of using $.connect function in jquery?
Difference between javascript and jquery? : jQuery Mobile
How to call a method inside code-behind using jquery?