cofactor
asked on
why this script does not work ?
I want to rename a field name using jquery .
This field is situated at the last but one <tr> inside myTable.
I use the following syntax to rename field name ...but this does not work
$('#myTable tr:eq(-2) > input[name="id0"]').attr(' name', 'id1');
whats wrong ? how do I correct it ?
This field is situated at the last but one <tr> inside myTable.
I use the following syntax to rename field name ...but this does not work
$('#myTable tr:eq(-2) > input[name="id0"]').attr('
whats wrong ? how do I correct it ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That code does not find name id0 in second last row ONLY. it searches entire table.
I want to update the name of input with name id0 in second last row only. I dont want to search other places
I want to update the name of input with name id0 in second last row only. I dont want to search other places
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Unlike the .eq(index) method, the :eq(index) selector does not accept a negative value for index. For example, while $('li').eq(-1) selects the last li element, $('li:eq(-1)') selects nothing.
Try this :
$('#myTable tr').eq(-2).find('input[na