Skip to content

Commit fb5cad3

Browse files
committed
Spinner: Don't clear invalid values on blur (but clear the value option).
1 parent 4d2ac1a commit fb5cad3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ui/jquery.ui.spinner.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ $.widget( "ui.spinner", {
8484
uiSpinner.addClass( "ui-state-active" );
8585
},
8686
blur: function( event ) {
87-
this.value( this.element.val() );
87+
// don't clear invalid values on blur
88+
var value = this.element.val(),
89+
parsed = this._parse( value );
90+
this.option( "value", parsed );
91+
if ( parsed === null ) {
92+
this.element.val( value );
93+
}
8894
// TODO: is this really correct or just the simplest
8995
// way to keep the active class when pressing the buttons?
9096
// if the mosue is over the text field and the user tabs out

0 commit comments

Comments
 (0)