javascript - Prevent multiple event triggering -
After
I am here again
$ (document) ). ("Check") [0] ("(": checkbox ") [0]; checkbox checked! Checkbox checked; self-toggle class ('on', checkbox checked ;; ) ". (": Checkbox "). (Function () {$ (this) .closest ('li' ('click', 'li', 'label', function () {var self = $ ( This),). Click on ('on', this.checked);}); $ ("# id_tipo" radio = self.find (": radio") [0]; radio is checked! Radio: Checked "$:" (": Radio: No (check)"). Each (function () {$ (this) .closest ('(' 'radio' '). {$ (This) .closest ('li'). ToggleClass ('on', this.checked);});
});
Everything Works fine but for labels, when I click on them, they do not chec, it seems that an event is triggering several times and it unchecks them, try setting an alert and you will see that What do I mean?
What is a wrong idea?
Because you are real Taking the role of input, you Ut element is allowed to continue with their behavior ()
if (event.target === box) return;
If you aim for the real input element, then all you should do is get back quickly. Now the input element is checking itself and after that you are unchecking yourself.
Comments
Post a Comment