How to get all child inputs of a div element (jQuery)

user137348 picture user137348 · Mar 8, 2010 · Viewed 401.7k times · Source

HTML:

<div id="panel">
  <table>
    <tr>
       <td><input id="Search_NazovProjektu" type="text" value="" /></td>
    </tr>
    <tr>
       <td><input id="Search_Popis" type="text" value="" /></td>
    </tr>
  </table>
</div>

I need to select all inputs in the particular div.

This's not working:

var i = $("#panel > :input");

Answer

Nick Craver picture Nick Craver · Mar 8, 2010

Use it without the greater than:

$("#panel :input");

The > means only direct children of the element, if you want all children no matter the depth just use a space.