How to Check on jQuery if a DOM Element Exists

Below is how you will able to know if a dom element exists 🙂 Quite simple!

[javascript]
if($("#dom").length > 0){
//dom exists
}else{
//dom doesn’t exists
}
[/javascript]


Posted

in

, ,

by

Comments

One response to “How to Check on jQuery if a DOM Element Exists”

  1. Tom Avatar
    Tom

    Thanks small and great! I will use “jQuery” rather then using the short version “$” because sometimes it conflicts with other javascript framework/library.

Leave a Reply

Your email address will not be published. Required fields are marked *