Reputation: 375
I have a function for updating multiple selects based on values of another select.
How can I edit this function to use it without prototype just with jquery ?
function replace(val) {
if (val != 0) {
$$('select.replace).each(function(e) {
var aa = e.value.split("_");
if (aa[0] = val) {
e.value = val + "_" + aa[1] + "_" + aa[2];
jQuery("select.replace").trigger("chosen:updated");
}
});
} else {
alert('Please select a valid value');
return false;
}
}
Upvotes: 0
Views: 65
Reputation: 55
Try using .change() when the select value is changed.
$( ".target" ).change(function() {
// code here
});
Upvotes: 1