Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're selecting on an id '#'.</p> <p>Dom's require unique id's.</p> <p>Try making it a class instead.</p> <p>So instead of</p> <pre><code>&lt;input id="roomID" type="text" /&gt; </code></pre> <p>Add a class</p> <pre><code>&lt;input class="roomID" type="text" /&gt; </code></pre> <p>Then</p> <pre><code>$('input.roomID').each(); </code></pre> <p>will select all of the inputs on the page with the class <code>roomID</code></p> <p><strong>EDIT</strong></p> <p>jQuery's each function will go through the selectors matches. So say you have this HTML:</p> <pre><code>&lt;input class="hello" /&gt; &lt;input class="hello" /&gt; &lt;span class="hello"&gt;text&lt;/span&gt; </code></pre> <p>Then when you call each like this:</p> <pre><code>$('.hello').each(function(i, ele){}); </code></pre> <p>jQuery will call the function 3 times each time the function will have <code>this</code>(or will be scoped) to the individual dom elements. It does this in the order they appear in the dom. So the first time through it will be <code>input</code> then <code>input</code> then <code>span</code>. </p> <p>Each time <code>this</code> will point to the respective dom element and not a jQuery mapped element. that's why you need to do <code>$(this)</code> to access jquery's helper methods as opposed to just <code>this.val()</code>. </p> <p>It also calls the function with 2 arguments, the first is the iteration number, so on the <code>span</code> case this would be 2. And the second is the element again.</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. 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