0

I have the following table which is loaded dynamically into a <div>.

https://i.stack.imgur.com/0s0p9.png

Now I am trying to traverse into the table as to disable all the input fields in the first column titled "index". How would I go about that?

What I have come up with is the following, but it fails:

$('#output').find('tr').each().find('td').first().find('input').attr('disabled','disabled');
James Montagne
  • 77,516
  • 14
  • 110
  • 130

2 Answers2

0
$('table tr td:nth-child(1) input').prop('disabled',true)

jsFiddle example

Since you didn't post the HTML for your table, I offer a generic example. You may be able to replace the selector with $('#output td:nth-child(1) input') depending on your exact code.

j08691
  • 204,283
  • 31
  • 260
  • 272
0

This should work as well.

$('#output tr td:first-child input').attr('disabled', 'disabled');

Everything in one selector. Tested in chrome only

http://jsfiddle.net/QGdJF/

milagvoniduak
  • 3,214
  • 1
  • 18
  • 18