get a row from dynamic table (jquery) -
i'm trying table using jquery reason cant specific row
i can use help
jquery
$('table').on('click','tr:gt(0)',function(e){ row=$(this).closest("tr"); $('tr').css('background-color', ''); row.css('background-color', 'yellow'); });
html
<table id="receivedfeeds" border="1"> <tr> <th>feed address</th> <th>feed name</th> <th>received from</th> </tr> </table>
php
function addsendedfeedtouser(){// create table of links , user send them connecttodb(); $username=mysql_real_escape_string($_session['username']); $sql=mysql_query("select * send_feed 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>'; }
}
$(this)
enough don't use .closest()
on that, since selector row.
$('table').on('click','tr:gt(0)',function(e){ row = $(this); $('tr').css('background-color', 'none'); row.css('background-color', 'yellow'); });
Comments
Post a Comment