Passing data to a jQuery click() function

后端 未结 5 2073
独厮守ぢ
独厮守ぢ 2021-01-01 21:21

I have a simple span like so

Remove

This span is within a table, each row has a remo

5条回答
  •  滥情空心
    2021-01-01 22:07

    You could have a hidden field on each row which stores the ID and/or other data needed in a JSON object & use that instead of hacking around with the span tag.

    
    
    Remove
    
    
    
    
    $('.removeAction').click(function(){
      var id = $(this).next().val();
      // do something...
    });
    

    HTH

提交回复
热议问题