Problems formatting jQuery statement
I'm trying to find a specific TR in my table. 开发者_如何学CEach TR ID ends with _rowX where X is the line number. For example, _row1.
How can I find a specific TR in my table using the row number being passed into a function. I'm having a problem formatting the code to find _row + the number being passed into the function.
For example:
function FindRow(row)
{
var tr = $('[id $= "_row" + row]');
tr.css(....
}
This fails because of the problem with the "'s.
I hope this makes sense.
Thank you!
Try this out:
function FindRow(row)
{
var tr = $('tr[id $="_row' + row +'"]');
tr.css(....
}
function FindRow(row)
{
var tr = $('#_row' + row);
tr.css(....
}
EDIT
If the ID ends with _row<number>
then you should try Neil's answer.
$('#_row' + row );
ID's can be selected directly, no need to use [id=] syntax.
精彩评论