Skip to content Skip to sidebar Skip to footer

JQuery check element is exist

Reading Time: < 1 minute

How can I check if some element is exist or not, using JQuery.Here describes check element by using JQuery and Java Script.If you already have basic knowledge of JQueryand Java Script this is simple.
Using JQuery

if ($("#elementID").length > 0) {
      alert('Element is exist');
}
else {
      alert('Element is not exist');
}

Using Java Script.

if (document.getElementById('elementID').length > 0) {
      alert('Element is exist');
}
else {
      alert('Element is not exist');
}