Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for issue 2315 - Flip toggle switch with change event bound, trig…

…gers multiple times

- Modified refresh() so that it checks to see if the value actually changed before firing off the "change" event.
  • Loading branch information...
commit 4fa6ccdc0d8625f58e43e446f24bc4e65f87cb1d 1 parent 114cee8
@jblas jblas authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 js/jquery.mobile.forms.slider.js
View
6 js/jquery.mobile.forms.slider.js
@@ -284,13 +284,17 @@ $.widget( "mobile.slider", $.mobile.widget, {
}
if ( !preventInputUpdate ) {
+ var valueChanged = false;
+
// update control"s value
if ( cType === "input" ) {
+ valueChanged = control.val() !== newval;
control.val( newval );
} else {
+ valueChanged = control[ 0 ].selectedIndex !== newval;
control[ 0 ].selectedIndex = newval;
}
- if ( !isfromControl ) {
+ if ( !isfromControl && valueChanged ) {
control.trigger( "change" );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.