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 jquery.noconflict? : jquery mobile

828


Explain various methods to make ajax request in jquery?

778


How to get/set the html contents of an element using jQuery?

841


Why is not dom ready working for jquery mobile? : jquery mobile

770


Can we have multiple document.ready() function on the same page? : jquery mobile

774


What does dollar sign ($) me in jquery?

945


Is it possible that jquery html work for both html and xml document?

730


What are the different types of selectors?

846


How To Use Ajax In Jquery?

816


Why use jQuery filter() Methods?

837


What are two different version of jquery library? : jquery mobile

798


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

822


How to disable/enable an element with jQuery?

884


Difference between document.ready() and body onload()?

820


How we can hide a block of html code on a button click using jquery?

808