从动态表(jquery)中获取一行

从动态表(jquery)中获取一行,jquery,Jquery,我正在尝试使用jquery获取一个表 由于某种原因,我无法得到具体的行 我需要一些帮助 jquery $('table').on('click','tr:gt(0)',function(e){ row=$(this).closest("tr"); $('tr').css('background-color', ''); row.css('background-color', 'yellow'); }); HTML PHP }$这就足够了,不要使用。最接近于此,因为选择器

我正在尝试使用jquery获取一个表 由于某种原因,我无法得到具体的行

我需要一些帮助

jquery

$('table').on('click','tr:gt(0)',function(e){
    row=$(this).closest("tr");
    $('tr').css('background-color', '');
    row.css('background-color', 'yellow');
});
HTML

PHP

}

$这就足够了,不要使用。最接近于此,因为选择器本身是一行

$('table').on('click','tr:gt(0)',function(e){
    row = $(this);
    $('tr').css('background-color', 'none');
    row.css('background-color', 'yellow');
});
function addSendedFeedToUser(){// create a table of links and the user who send them
connectToDB();
$username=mysql_real_escape_string($_SESSION['username']);
$sql=mysql_query("SELECT * FROM send_feed WHERE user_receive='$username'") or die(mysql_error());
while($row=mysql_fetch_array($sql)){
echo '<tr>  <td>'.$row['feed_url'].'</td><td>'.$row['feed_name'].'</td> <td>'.$row['user_send'].'</td></tr>';
}
$('table').on('click','tr:gt(0)',function(e){
    row = $(this);
    $('tr').css('background-color', 'none');
    row.css('background-color', 'yellow');
});