Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Most jQuery member <code>Functions</code> do not have a return value but rather return the current <code>jQuery Object</code> or another <code>jQuery Object</code>.</p> <hr> <p>So, </p> <pre><code>console.log("(!!) jquery &gt;&gt; " + $("#id") ) ; </code></pre> <p>will return <code>[object Object]</code>, i.e. a <code>jQuery Object</code> which maintains the collection which is the result of evaluating the selector <code>String</code> (<code>"#id"</code>) against the <code>Document</code>,</p> <p>while ,</p> <pre><code>console.log("(!!) getElementById &gt;&gt; " + document.getElementById("id") ) ; </code></pre> <p>will return <code>[object HTMLDivElement]</code> (or in fact <code>[object Object]</code> in IE) because/if the return value is a <code>div</code> <code>Element</code>.</p> <hr> <blockquote> <p>Also what methods can operate on jQuery object vs DOM element? (1) Can a single jQuery object represent multiple DOM elements ? (2)</p> </blockquote> <p>(1) There is a host of member <code>Function</code>s in jQuery that pertain to DOM <code>Object</code>s. The best thing to do imo is search the jQuery API documentation for a relevant <code>Function</code> once you have a specific task (such as selecting <code>Node</code>s or manipulating them).</p> <ul> <li><a href="http://docs.jquery.com/Main_Page" rel="nofollow">jQuery documentation</a></li> </ul> <p>(2) Yes, a single <code>jQuery Object</code> may maintain a list of multiple DOM <code>Element</code>s. There are multiple <code>Functions</code> (such as <code>jQuery.find</code> or <code>jQuery.each</code>) that build upon this automatic caching behaviour.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload