corenzan / readonly.js

Make form controls - even <select> - read-only.
MIT License
35 stars 11 forks source link

Update sham when the input is changed via JavaScript #5

Closed boscolau closed 6 years ago

boscolau commented 7 years ago

Suggest add on change event: $('input').on('change, function() { // update corresponding hidden value of input with same name $('input:hidden[data-sham="'+ $(this).name +'"]').val(''); })

in case the value is programmatically changed. e.g. $('select').val('changed value').trigger('change')

quevon24 commented 6 years ago

Please add a method to update the hidden values at any case, I found that the only way to do that is doing this: readonly($("#my_selector"), false); readonly(t$("#my_selector"), true);

haggen commented 6 years ago

@boscolau @quevon24 This issue should be resolved with version 3. Thank you for reporting this bug and please let me know if you run into any more issues.