Jquery select input that is within a TD
15,054
Solution 1
Just try:
$("#TBI tr.t-state-selected input")
Or for the input inside the second td:
$("#TBI tr.t-state-selected:nth-child(1) input");
Demo: Fiddle
Solution 2
$('#TBI tr.t-state-selected td input')
Solution 3
$("input[type=text]", "div#TBI tr.t-state-selected td");
Author by
carlg
Updated on June 05, 2022Comments
-
carlg almost 2 years
Here is the HTML code that I copied/pasted using Firebug:
<div id="TBI"> <tr class="t-state-selected t-grid-edit-row"> <td>8081</td> <td class="t-grid-edit-cell"> <input id="ijn" class="text-box single-line valid" type="text" value="" name="ijn"> </td>
I'm able to access the 2nd cell of this table using the following:
$('#TBI tr.t-state-selected')[0].cells[1]
and all works well.
But, how can I get a jquery reference to the input that is contained within the TD? Once I figure out how to get a selector for that text box, I can manipulate it as I wish.
Thanks ahead of time for help!