Can't reset value of NumericTextBox

3 posts, 0 answers
  1. Bryan
    Bryan avatar
    1 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2012 Link to this post

    I can set the value to a specific amount like this:
    But if I try this after setting the value as above, the value does not change.
    I have also tried the following with nothing being able to clear out the previously set value.

    Is there any way to clear out the value once it's been set?
  2. John DeVight
    John DeVight avatar
    209 posts
    Member since:
    Jan 2010

    Posted 09 Aug 2012 Link to this post

    Hi Bryan,

    There are several things that need to happen to clear the value.  If I have a NumericTextBox defined as follows:

    var _numeric = $("#numeric").kendoNumericTextBox({
        min: 0,
        max: 100
    I could clear it with the following lines of code:
    _numeric._old = _numeric._value;
    _numeric._value = null;

    Another possibility is if you want to use this for any of your NumericTextBox controls, you could extend the NumericTextBox.  This would be done after the reference to the kendo javascript library, but before any NumericTextBox's are created.  Here would be the code:

    $.extend(window.kendo.ui.NumericTextBox.fn, {
        clear: function() {
            this._old = this._value;
            this._value = null;

    Then, to clear a NumericTextBox, you could call the clear function like this:


    Attached is an example of this.


    John DeVight
  3. Jack
    Jack avatar
    4 posts
    Member since:
    Feb 2015

    Posted 11 Jan Link to this post

    Thank you Mr. DeVight.  You helped me out a lot.  Works great.
Back to Top