I can set the value to a specific amount like this:
$("#ntAmount").data("kendoNumericTextBox").value(100);
But if I try this after setting the value as above, the value does not change.
("#ntAmount").data("kendoNumericTextBox").value("");
I have also tried the following with nothing being able to clear out the previously set value.
("#ntAmount").data("kendoNumericTextBox").value(0);
("#ntAmount").data("kendoNumericTextBox").value(null);
Is there any way to clear out the value once it's been set?
$("#ntAmount").data("kendoNumericTextBox").value(100);
But if I try this after setting the value as above, the value does not change.
("#ntAmount").data("kendoNumericTextBox").value("");
I have also tried the following with nothing being able to clear out the previously set value.
("#ntAmount").data("kendoNumericTextBox").value(0);
("#ntAmount").data("kendoNumericTextBox").value(null);
Is there any way to clear out the value once it's been set?
4 Answers, 1 is accepted
0
John DeVight
Top achievements
Rank 1
answered on 09 Aug 2012, 07:03 PM
Hi Bryan,
There are several things that need to happen to clear the value. If I have a NumericTextBox defined as follows:
I could clear it with the following lines of code:
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:
Then, to clear a NumericTextBox, you could call the clear function like this:
Attached is an example of this.
Regards,
John DeVight
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
}).data(
"kendoNumericTextBox"
);
I could clear it with the following lines of code:
_numeric._old = _numeric._value;
_numeric._value =
null
;
_numeric._text.val(_numeric._value);
_numeric.element.val(_numeric._value);
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
;
this
._text.val(
this
._value);
this
.element.val(
this
._value);
}
});
Then, to clear a NumericTextBox, you could call the clear function like this:
_numeric.clear();
Attached is an example of this.
Regards,
John DeVight
0
Jack
Top achievements
Rank 1
answered on 11 Jan 2016, 08:53 PM
Thank you Mr. DeVight. You helped me out a lot. Works great.
0
Allan
Top achievements
Rank 1
answered on 04 Oct 2017, 01:54 AM
Whilst this does indeed clear the textual value, the tooltip remains when you hover over the "cleared" input field. Is there a way to also clear that, or better yet, Telerik, what is correct way to reset the numeric textbox back to empty?
0
Hello Allan,
You can set the NumericTextBox value to null to clear the textbox and tooltip:
Dojo: http://dojo.telerik.com/@tsveti/Acepoz
Regards,
Tsvetina
Progress Telerik
You can set the NumericTextBox value to null to clear the textbox and tooltip:
var
numeric = $(
"#currency"
).data(
"kendoNumericTextBox"
);
numeric.value(
null
);
Dojo: http://dojo.telerik.com/@tsveti/Acepoz
Regards,
Tsvetina
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.