JQuery select input that is inside TD

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 can access the second cell of this table using the following:

$('#TBI tr.t-state-selected')[0].cells[1] 

and everything works well.

But how can I get the jquery link to the input that is contained in TD? Once I figure out how to get a selector for this text box, I can manipulate it as I wish.

Thanks for the help!

+3
source share
3 answers

Just try:

$("#TBI tr.t-state-selected input")

Or to enter inside the second td:

$("#TBI tr.t-state-selected:nth-child(1) input");

Demo: Fiddle

+8
source
$('#TBI tr.t-state-selected td input')
+2
source
$("input[type=text]", "div#TBI tr.t-state-selected td");
0
source

All Articles