Saturday 3 November 2018

javascript: how i can define is object jQuery object or something else object?





So, i have two objects:



var object1 = $('div');
var object2 = {};


How i can define is this jQuery object, or not?




for javascript version < 1.4


Answer



var abc={};

if(typeof(abc.jquery)=="undefined"){

console.log("object is not a jquery object");

}else{


console.log("object is a jQuery object");

}


if object is jQuery object then



objectIdentifier.jquery =< version of jQuery>


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...