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 |
Whether we need to add jQuery file in both Master and Content page?
What is the need for jquery? : jQuery Mobile
How can you use array with jquery?
What does the jQuery migrate function do?
How can you delay document.ready until a variable is set?
Difference between prop() and attr()? : jQuery Mobile
What is the difference between $.map and $.grep in jQuery?
Differentiate the concepts of .js and .min.js?
Define the script build up by jquery?
Jumping off of jquery ui for a second, do you 'release early, release often' with all of your projects? What are your thoughts on that strategy?
What is wrong with this code line "$('#myid.3').text('blah blah!!!');"
Can we call C# code behind using jQuery?