<!DOCTYPE html>
<html>
<body>
<div id="find-me"></div>
<script>
var elementExists = document.getElementById("find-me");
if (typeof(elementExists) != 'undefined' && elementExists != null)
{
alert("find-me id exist");
}
var h5 = document.querySelector('h5');
if (typeof(h5) != 'undefined' && elementExists != null)
{
alert("h5 not exist");
}
</script>
</body>
</html>
Most Helpful This Week
How to build simple tabs with jQuery?
How to join string with number in JavaScript?
jQuery move multi select values from one to another multi select list
How to change text color on click using JavaScript?
How to declare multiple variables in one statement in Javascript?
JavaScript convert string variable in boolean using Regex
Check if a string ends with the given target string
jQuery get the coordinates of div clicked
Edit the text of label on click using jQuery
Using jQuery add new table row on click