Q:

Check if an object is a jQuery object using jquery

0

Check if an object is a jQuery object  using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
  <html>
  <head>
  <script src="https://code.jquery.com/jquery-git.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Check if object is a jQuery object.</title>
  </head>
  <body>
</body>
  </html>
JavaScript Code:
var obj1 = { what: "A regular JS object" },
obj2 = $('body');

if ( obj1.jquery )
{
     console.log('obj1 is a jQuery object.');    
}

if (obj2.jquery )
{ 
      console.log('obj2 is a jQuery object.');
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now