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 check or uncheck all checkboxes using jquery?
Tell me how do you stop the currently-running animation? : jquery mobile
How to use jquery.connect?
How to get/set the html contents of an element using jQuery?
List browser related issues for jquery?
How to find all sibling elements after the current element using ?
What is .detach()? : jquery mobile
How do you disable or enable a form element?
What is the use of jquery.data()?
How to run an event handler only once in jQuery?
Define jquery filter?
What is the difference between onclick and onsubmit?
Explain is jquery replacement of java script? : jquery mobile
Will Events Are Also Copied On Clone In Jquery?
How to debug jquery code/ debug jquery?