Reputation: 13
I have a table that looks like this Table:
For each select (when changed) I want to run a function that uses the values from that specific row
I have this but only works for the first select
$('#selectID').change(function(){
var tr =$(this).closest('tr');
var IDD = tr.find($('#selectID option:selected')).val();
);
Upvotes: 1
Views: 77
Reputation: 119
id of button duplicate so it is not working best way set button class="selectID" then write this code
$('.selectID').change(function(){
var tr =$(this).closest('tr');
var IDD = tr.find($('#selectID option:selected')).val();
);
Upvotes: 0
Reputation: 104775
Target all your selects, then use an instance of this
to access the value:
$("select").change(function() {
console.log(this.value);
});
Upvotes: 1