mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-23 01:10:25 +00:00
Fix for issue 2315 - Flip toggle switch with change event bound, triggers multiple times
- Modified refresh() so that it checks to see if the value actually changed before firing off the "change" event.
This commit is contained in:
parent
114cee84fe
commit
4fa6ccdc0d
1 changed files with 5 additions and 1 deletions
|
|
@ -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" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue