diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2013-09-11 22:00:27 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2013-09-13 00:16:31 +0200 |
commit | 1552fc8a05ad351650b2a56c5c31905c671f1cdf (patch) | |
tree | 23f11b203b629b98456037a62ef1737dbf19309f /ui | |
parent | 6e799c39d33be8eee02224d2f754dc42228a4cbb (diff) | |
download | jquery-ui-1552fc8a05ad351650b2a56c5c31905c671f1cdf.tar.gz jquery-ui-1552fc8a05ad351650b2a56c5c31905c671f1cdf.zip |
Spinner: Add isValid method. Fixes #9542 - Spinner: Add isValid() method
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.spinner.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index c022413dc..a4912fc7e 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -418,6 +418,18 @@ $.widget( "ui.spinner", { }); }, + isValid: function() { + var value = this.value(); + + // null is invalid + if ( value === null ) { + return false; + } + + // if value gets adjusted, it's invalid + return value === this._adjustValue( value ); + }, + // update the value without triggering change _value: function( value, allowAny ) { var parsed; |