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 |
Is it possible to use jquery to make ajax request? : jquery mobile
Explain the difference between $(this) and 'this' in jquery?
What is jquery selectors? Give some examples.
Can we select a element having a specific class in jquery ?
Define url paremeter of jquery ajax method?
How jQuery selectors are executed?
What is the latest version of jquery?
How do you get the text value of a selected option?
What are selectors in jquery?
Why is not dom ready working for jquery mobile? : jquery mobile
Explain jquery.noconflict? : jquery mobile
How do you add an HTML element in DOM tree?