Is there a fast way of checking if an object is a jQuery object or a native javascript object?
example:
var o = {};
var e = $('#element');
function doStuff(o) {
if (o.selector) {
console.log('object is jQuery');
}
}
doStuff(o);
doStuff(e);
obviously, the code above works but it's not safe. You could potentially add a selector key to the o
and get the same result. Is ther a better way of making sure that the object actually is a jQuery object?
Something in the line of (typeof obj == 'jquery')