Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How do you check if an element is empty?

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


Please Help Members By Posting Answers For Below Questions

What is jquery a client or server scripting?

863


What is the between $(this) and 'this' in jquery?

871


What is the use of queue() in jquery?

864


What is the difference between find and children methods?

912


Why is jquery better than javascript?

1006


How to multiple version of jQuery?

892


Can you give me a brief history of your programming days? Where did it all start?

975


How to programmatically trigger a click event thats being handled by jquery only?

848


What features of jquery, has been used in web applications?

833


How To Use Ajax In Jquery?

858


Explain the difference between jquery's ready and holdready?

803


How to use jquery library in our asp.net project?

897


What are the popular jquery cdn? : jquery mobile

866


What is queue() in jquery?

913


Define jquery filter?

892