How to know whether id is exists or not in JQuery code example
Example: 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.
}
});