I
I
Ivan Antonov2016-08-25 14:32:26
JavaScript
Ivan Antonov, 2016-08-25 14:32:26

Why does the first click on a button fire twice in UIkit?

If the button is wrapped in a Div with attribute data-uk-button-checkboxor data-uk-button-radiothen it fires twice on the first click.
Here is an example:
https://jsfiddle.net/wyj6wp0r/
Tell me why? And how to avoid it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Antonov, 2016-08-25
@antonowano

Tired of looking for a stable solution. Excluded attributes from div data-uk-button-checkboxand data-uk-button-radioorganized their logic in JS. On click, I add or remove a class uk-activeand everything works like clockwork.

V
Vitaly, 2016-08-25
@vshvydky

https://jsfiddle.net/wyj6wp0r/10/
Apparently somewhere deep deep there is some kind of once event (single).
the solution is to block it via return false

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question