Reputation: 1566
I would still take advantage of the expertise and availability of this community.
My question is: why if we have a code similar to
<input name="" type="checkbox" onClick="first()" onChange="second()">
<script type="text/javascript">
function first(){
console.log('first')
}
function second(){
console.log('second')
}
</script>
in firefox onclick event fires before onchange while in chrome happens the opposite?
Thanks for your answers, maybe i have not explained in the best way
I know that using onMuseDown the problem is solved but i want to understand the reason for such behavior in Chrome with the onchange and onclick event
Upvotes: 4
Views: 2122
Reputation: 630
One dirty solution might be to use onMouseDown
instead of onClick
.
But I'm also wondering why you really need both ;)
Upvotes: 1