jQuery


if ($('#elementId').length > 0) {
  // element exists.
}

JavaScript


var el =  document.getElementById('elementId');
if (typeof(el) != 'undefined' && el != null)
{
  // element exists.
}

 

0 Comments

Leave a reply

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