title: Jquery Each Input Within DIV (Has A Table)
body: <p>Im currently trying to get all input elements from a DIV.</p>
  
  <pre><code>$("[required]").each(function() {
  
  });
  </code></pre>
  
  <p>I have this code which returns every element with a <code>required</code> attribute.</p>
  
  <p>I know within the function of that <code>each()</code> I can use each item like:</p>
  
  <pre><code>$(this)
  </code></pre>
  
  <p>So I get the div ID's shown below, and try to get all the inputs from it via:</p>
  
  <pre><code>var id = $(this).attr('id');
  console.log("### " + id);
  console.log($("#" + id + " &gt; :input").length);
  </code></pre>
  
  <p>Which returns 0 when I have 4 in put elements within that DIV (also theres a table in the div).</p>
  
  <p>What I would ideally like to do is for each input element within my div, print its ID.</p>
  
  <p>UPDATED</p>
  
  <pre><code>&lt;div id="contactAddress" required="true"&gt;
  
   &lt;td&gt;Addres line 1:&lt;/td&gt;
   &lt;td colspan="2"&gt;
   &lt;input type="text"/&gt;
   &lt;/td&gt;
   &lt;td&gt;Addres line 2:&lt;/td&gt;
   &lt;td colspan="2"&gt;
   &lt;input type="text" /&gt;
   &lt;/td&gt;
   &lt;/tr&gt;
  &lt;/div&gt;
  
  console.log($(this).html());
  </code></pre>
  
  <p>Shows nothign but if i add anythign outsire the  or  like below...</p>
  
  <pre><code> &lt;div id="contactAddress" required="true"&gt;
   &lt;input type="text" /&gt;
  </code></pre>
  
  <p>And run  <code>console.log($(this).html());</code> It shows it put not the table?</p>
  
  <p>Any ideas im using Jquery Mobile</p>