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
What is jquery a client or server scripting?
What is the between $(this) and 'this' in jquery?
What is the use of queue() in jquery?
What is the difference between find and children methods?
Why is jquery better than javascript?
How to multiple version of jQuery?
Can you give me a brief history of your programming days? Where did it all start?
How to programmatically trigger a click event thats being handled by jquery only?
What features of jquery, has been used in web applications?
How To Use Ajax In Jquery?
Explain the difference between jquery's ready and holdready?
How to use jquery library in our asp.net project?
What are the popular jquery cdn? : jquery mobile
What is queue() in jquery?
Define jquery filter?