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 can you select all elements in a page using jquery?
Mention the differences between javascript and jquery.
How to get the style property of an element using ?
How To Use Ajax In Jquery?
Difference between document.ready and window.onload? : jQuery Mobile
How to execute jQuery code after the DOM is ready?
What are the slow selectors in jquery? : jquery mobile
Define type paremeter of jquery ajax method?
Explain slidetoggle() effect.
Need to add jQuery file in both Master and Content page?
How can we include jQuery library in ASP.Net project?
What is a cdn? : jQuery Mobile
Is jquery still relevant 2019?
Can you use multiple document.ready() function on the same page?
In what scenarios jQuery can be used?