get a row from dynamic table (jquery)

itay amar

I'm trying to get a table using jquery for some reason I cant get the specific row

I can use some 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 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>';
}

}

Rajaprabhu Aravindasamy

$(this) is enough don't use .closest() over that, since the selector itself is a row.

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Jquery to get table row values of selected checkboxes

From Dev

JQuery : Get div defined in same table row

From Dev

how to get a row index in dynamic table via jQuery

From Dev

jQuery - Get table row count with a certain class

From Dev

Jquery get row value in a table

From Dev

Get table row by row index jquery

From Dev

Get randomically or row from a table

From Dev

get value of a specific row of a table using jquery

From Dev

Get dropdown selected value from jquery template in table row

From Dev

Get m Rows starting from nth row in dynamic MySql table

From Dev

jQuery delete table row by dynamic id

From Dev

How to delete a specific row of a dynamic table using JQuery

From Dev

Get Table Row Column and Header JQuery

From Dev

Get html code of table row with jquery

From Dev

Jquery get row value in a table

From Dev

Get row from a table by td class and specific value in the cell in jquery

From Dev

get a row from dynamic table (jquery)

From Dev

JQuery dynamic binding on table row

From Dev

How to get every id on a row in a table with jQuery?

From Dev

Get dropdown selected value from jquery template in table row

From Dev

Get row id of dynamic table in html

From Dev

Delete row from dynamic table

From Dev

jQuery - Get data from table row and post it

From Dev

How to delete table certain table row created from dynamic dataTables using jquery?

From Dev

How to get row id of particular row from legacy jQuery data table

From Dev

Get a dynamic table td value using jquery

From Dev

Get Id of a Checkbox from a dynamic html table column using Jquery

From Dev

I tried to get dynamic data from server to angular table but it's displaying only first row

From Dev

Jquery specify result loops on specific row of dynamic table header

Related Related

  1. 1

    Jquery to get table row values of selected checkboxes

  2. 2

    JQuery : Get div defined in same table row

  3. 3

    how to get a row index in dynamic table via jQuery

  4. 4

    jQuery - Get table row count with a certain class

  5. 5

    Jquery get row value in a table

  6. 6

    Get table row by row index jquery

  7. 7

    Get randomically or row from a table

  8. 8

    get value of a specific row of a table using jquery

  9. 9

    Get dropdown selected value from jquery template in table row

  10. 10

    Get m Rows starting from nth row in dynamic MySql table

  11. 11

    jQuery delete table row by dynamic id

  12. 12

    How to delete a specific row of a dynamic table using JQuery

  13. 13

    Get Table Row Column and Header JQuery

  14. 14

    Get html code of table row with jquery

  15. 15

    Jquery get row value in a table

  16. 16

    Get row from a table by td class and specific value in the cell in jquery

  17. 17

    get a row from dynamic table (jquery)

  18. 18

    JQuery dynamic binding on table row

  19. 19

    How to get every id on a row in a table with jQuery?

  20. 20

    Get dropdown selected value from jquery template in table row

  21. 21

    Get row id of dynamic table in html

  22. 22

    Delete row from dynamic table

  23. 23

    jQuery - Get data from table row and post it

  24. 24

    How to delete table certain table row created from dynamic dataTables using jquery?

  25. 25

    How to get row id of particular row from legacy jQuery data table

  26. 26

    Get a dynamic table td value using jquery

  27. 27

    Get Id of a Checkbox from a dynamic html table column using Jquery

  28. 28

    I tried to get dynamic data from server to angular table but it's displaying only first row

  29. 29

    Jquery specify result loops on specific row of dynamic table header

HotTag

Archive