Using jQuery, how can I validate if a div exists in body of a HTML page or not?
For the presence of any div:
if ($("div").length > 0) { // theres a div }
Or a particular element with an ID:
if ($("#id").length > 0) { // it exists }
var divExists = !!$('div').length;