RFE: deserialize function should fire change events
enrico-usai opened this issue · 2 comments
enrico-usai commented
I have some users interface components (i.e. divs) that are shown or hidden according to the value of a select.
After form deserialization the selected value changes but the change event isn't triggered.
You could add something like $(element).change();
after the update of the select.
$.each( fields, function( index, field ) {
if ( field.value == value ) {
field[ property ] = true;
callback.call( field, value );
}
});
$(element).change();
To reproduce:
jQuery(document).ready(function () {
jQuery('#selectid').change(function () {
console.log(jQuery(this).val());
});
});
You don't see the log if there is no the $(element).change();
action.
Thank you.
kflorence commented
@EnricoU the change
function is called for each modified form value, you could easily add the event trigger there:
$("form").deserialize({ change: function() {
$(this).trigger("change");
});
enrico-usai commented
It works perfectly. Thank you