Saturday, 23 September 2017

javascript - How do I check if a variable is a jQuery object or plain DOM element?



How do I check if a variable is a jQuery object or plain DOM element?


Answer




  • A jquery object has a jquery property.

  • A jquery object is an instanceof jQuery (instanceof on MDN)


  • A DOM element has a nodeType property


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...