How to reload a value in only one row of table

后端 未结 2 408
孤街浪徒
孤街浪徒 2021-01-22 02:56

i am have a table and there are some data in tables, and i have a refresh button in the last column of every row.

what i want is when i click some refresh button in some

相关标签:
2条回答
  • 2021-01-22 03:36

    use this reference

    $("button").click(function(){
      $(this).parents('tr').find(".b1").load("content.txt");
      $(this).parents('tr').find(".b2").load("content1.txt");
    });
    

    or

    $("button").click(function(){
      $(this).parent().siblings(".b1").load("content.txt");
      $(this).parent().siblings(".b2").load("content1.txt");
    });
    
    0 讨论(0)
  • 2021-01-22 03:38

    $(".b1") and $(".b2") are selecting every element with that class. You need to filter based on the row the button is in using something like this:

    $("button").click(function(){
        var $row = $(this).closest("tr");
        $row.find(".b1").load("content.txt");
        $row.find(".b2").load("content1.txt");
    });
    
    0 讨论(0)
提交回复
热议问题