Flip toggle switch with change event bound, triggers multiple times #2315

vpxavier opened this Issue Aug 20, 2011 · 5 comments


None yet

4 participants


Hello in this jsFiddle: http://jsfiddle.net/vpxavier/K7puf/
if you go to "page1", you will see that the change event is triggered multiple times when you click to change the switch's value.

Tested on Android with JQM beta 2


Also tested on google chrome


Still occurs with today's latest build

@gseguin gseguin was assigned Sep 5, 2011
dannyc commented Sep 5, 2011

Three additional details:

  • Multiple events only fires when you click on the slider "cover". If however you click on the work "off" or "on" only one event fires.
  • The values being returned at the change event are inconsistent. For example http://jsfiddle.net/p5QCZ/ forked from above I added the val() being returned at each bind event. The first event firing returns value before the click, and the second the desired value.
  • Click and hold sliding with the mouse fires an uncountable number of events.
@jblas jblas was assigned Sep 22, 2011
jblas commented Sep 22, 2011

This is happening because refresh() is called from both vmousedown and vmouseup with the same signature that allows it to go into the are of code that updates the control's value and dispatches the "change" event. For some reason this code does NOT check to see if the value actually did change before triggering the change event.

I have a fix for this. I'll check it in after I finish the unit test case for it.

jblas commented Sep 22, 2011

Landed the fix on the HEAD:


@jblas jblas closed this Sep 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment