Reputation: 137
I have a simple table has 4 columns two of them dropdown menus with class= "ddm1" and "ddm2", what I need:
when user select any of these two dropdown menus, update flag column with a letter "g", else keep it empty. here what I tried : https://jsfiddle.net/yfzndsb3/1/
$(document).ready(function(){
$('select option[value="0"]').attr("selected",true);
$('.cf-table-block tbody tr').each(function () {
$(this).find('.ddm1 option').each(function () {
if(this.selected) {
$('.ddm1 input').closest("tr").find(".flag input").val("g");
}
else {
$('.ddm2').attr('disabled', true);
}
}
});
});
});
Upvotes: 0
Views: 44
Reputation: 117
Here's what I tried, let me now if this is what you need. You have a little mistake with the class attribute:
<td calss="ddm1">
but I made it different. (Also, you didn't load the jQuery library in your fiddle)
https://jsfiddle.net/yfzndsb3/4/
Upvotes: 1