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?



How do you check if an element is empty?..

Answer / 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

More jQuery Interview Questions

Which program is useful for testing jQuery?

0 Answers  


Is it possible to use jquery to make ajax request? : jquery mobile

0 Answers  


What are the different ways of using $.connect function in jquery?

0 Answers  


Difference between $(this) and 'this' in jQuery?

1 Answers  


How to executed jquery selectors? : jquery mobile

0 Answers  


How to include jquery library in asp.net project?

0 Answers  


How do you get the attribute of an html tag in jquery?

0 Answers  


Tell me how to disable jquery animation? : jquery mobile

0 Answers  


What is the name of jquery method used for an asynchronous http request?

0 Answers  


Explain the difference between jquery-x.x.x.js and jquery.x.x.x min.js?

0 Answers  


What is get()? : jquery mobile

0 Answers  


Which one is more efficient, document.getElementbyId( "myId") or $("#myId)?

0 Answers  


Categories