exist var? OR exist object ?
how determine existence?
JavaScript
function existVar(variable1) { //How can I check the existence of variable in javascript?
if (typeof variable1 !== 'undefined') return true;
else return false;
}
function existObj(selector1) {
//How can I check the existence of an element in jQuery?
if ($(selector1).length > 0) return true
else return false;
}
if (existObj(document)) alert('Result yes');
else alert('Result no');