lundi 20 avril 2015

Shiftcheckbox on change event bug/issue (doesnt trigger onChange number correctly)

I have a table with checkbox in the end of every row, by this code i highlight the last td if checkbox was changed

$(document).on('change', 'input[type="checkbox"]', function() { $(this).toggleBackgroundColorByTag('blah-blah-parameters'); });

I modified shiftcheckbox options(because it doesn`t trigger onChange by default) with this property:

onChange: function() { this.trigger('change'); }

BUT now when I click checkboxes with shift it triggers 'change' n+1 time (if I have 10 checkboxes clicked than 11 'onChange' will be triggered).

Is it a bug? Or did I do something wrong? What should I do if I want exactly the same quantity of 'change' triggered as checkboxes I actually clicked?

P.S. I submitted an issue on plugin`s github page, but I guess it is good to also ask a question here.

Aucun commentaire:

Enregistrer un commentaire