Thank you! Of course, it makes sense. I guess I was caught up on the readonly attribute of the input box, not thinking about it as a class for the TD. One minor problem, I had to use ":first" instead of ":first-child" (didn't focus anything). But it works!
On Oct 28, 6:26 pm, Ryura <[EMAIL PROTECTED]> wrote: > $('tbody>tr:last-child>td:not(.readonly):first- > child>input').focus().select(); > > On Oct 28, 7:07 pm, TimW66 <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I have a table that I will usually want to focus the first input box > > in the first column in the last row. Something like this: > > > <table> > > <tbody> > > <tr> > > ... > > </tr> > > <tr> > > <td> > > <input> <-- selects this one > > <input type="hidden"> > > </td> > > <td> > > <input> > > </td> > > </tr> > > </tbody> > > </table> > > > And I use this to do that part: > > $('tbody>tr:last-child>td:first- > > child>input').focus().select(); > > > The problem is, in some cases, that input field is readonly, so I > > don't want to select it. I want to select the input in the next TD. > > If an input is readonly, the parent TD has the "readonly" class. I > > tried the following, but they didn't work: > > $('tbody>tr:last-child>td:not(readonly):first- > > child>input').focus().select(); > > $('tbody>tr:last-child>td:not([EMAIL PROTECTED]):first- > > child>input').focus().select(); > > $('tbody>tr:last-child>[EMAIL PROTECTED]):first- > > child>input').focus().select(); > > $('tbody>tr:last-child>td:not([EMAIL PROTECTED]"readonly"]):first- > > child>input').focus().select(); > > > I think the last one is close, but the parent TD could also have > > another class. > > > Can anyone help?