how to know that an element exists using jQuery code example
Example 1: jquery test div exists
$(document).ready(function() {
var $myDiv = $('#DivID');
if ( $myDiv.length){
//you can now reuse $myDiv here, without having to select it again.
}
});
Example 2: jQuery exists function
if ($("#myElementID").length){
//I exist
}