adspace
Answer Posted / chaitanya
There are 2 ways to check if element is empty or not. We can check using ":empty" selector.
Hide Copy Code
$(document).ready(function(){
if ($('#element').is(':empty')){
//Element is empty
}
});
And the second way is using the "$.trim()" method.
Hide Copy Code
$(document).ready(function(){
if($.trim($('#element').html())=='') {
//Element is empty
}
});
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Do you have plans for a new jquery plug-in or something else we should look out for? Where to from here for the imgpreview plugin?
How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.
How to validate email using jquery?
How can jquery library be added to pages?
How to always reference latest version of jquery?
What is the minimum setup needed to start using jquery.