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 exists or not in jQuery?

Answer Posted / chaitanya

Using jQuery length property, we can ensure whether element exists or not.

Hide Copy Code

$(document).ready(function(){

if ($('#element').length > 0){

//Element exists

}

});

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of the .pushstack() method.

786


How We Can Write Code Specific To Browser In Jquery?

766


How To Use Ajax In Jquery?

769


What are the four parameters used for jQuery Ajax method?

799


What happen if you return false from a jQuery event handler?

804


What is the difference between $.map and $.grep in jQuery?

814


Have any of your startup projects failed dismally - if so, why and how did you learn from them?

780


Explain which program is useful for testing jquery?

9015


Define cache paremeter of jquery ajax method?

722


Explain the concepts of "$ function" in jquery with an example?

807


Different ways of using $.connect function in jquery?

833


What is the difference between jquery and javascript?

819


what are the features of jquery

768


How can jquery be used in conjunction with another javascript library that also uses $ for naming?

750


What are some of the ways to provide effects? : jQuery Mobile

728