How do I check if a variable is a jQuery object or plain DOM element?
Asked
Active
Viewed 5,129 times
19
-
3See http://stackoverflow.com/questions/1853223/check-if-object-is-a-jquery-object – Crescent Fresh Aug 06 '10 at 17:30
1 Answers
41
- A jquery object has a
jqueryproperty. - A jquery object is an
instanceof jQuery(instanceofon MDN) - A DOM element has a
nodeTypeproperty
fregante
- 25,786
- 14
- 106
- 143
meder omuraliev
- 177,923
- 69
- 381
- 426