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 resize() function in jquery?
How we can apply css in multiple selectors in jquery?
What is a jquery ajax?
How to fetch the values of selected checkbox array using jquery?
Explain cache paremeter of jquery ajax method?
Explain some of the key concepts of good code organization patterns.
Explain the common methods of sending a request to a server.
Which are the fastest selectors in jquery? : jquery mobile
How to set attributes of an element using jquery?
What is jquery.noconflict? Explain
What is the use jQuery.data method?
Explain remove class jquery with example?
What features of jquery, has been used in web applications?
Explain the difference between find and children methods in jquery?
What is the difference between jquery-x.x.x.js and jquery.x.x.x min.js?