I have quick and simple question. How can I check that an element is in the DOM or not?
For example how can I check if there is
here are three different ways:
if ($("#does_i_really_exist_or").length > 0) {
// do something
}
if ($("#does_i_really_exist_or").size() > 0) {
// do something
}
if ($("#does_i_really_exist_or")[0]) {
// do something
}
if ($("#does_i_really_exist_or").length > 0) {
// do something
}
if ( $("#does_i_really_exist_or").length ) {
//-- It does exist.
}