Persist the Old NumericTextBox Value
Environment
Product | Progress® Kendo UI® NumericTextBox for jQuery |
Operating System | Windows 10 64bit |
Visual Studio Version | Visual Studio 2017 |
Preferred Language | JavaScript |
Description
How can I persist the old value of the Kendo UI for jQuery NumericTextBox?
Solution
The following example demonstrates how to achieve the desired scenario.
<div id="example">
<div class="demo-section k-header">
<h4>Set value</h4>
<input id="numerictextbox"/>
</div>
<div class="box">
<h4>Console log</h4>
<div class="console"></div>
</div>
<script>
$(document).ready(function() {
var old = ""; //variable that persists the old value
function onChange() {
$(".console").append("<p>Change :: " + this.value() + ", old: " + old + "<p>");
old = this.value(); //get value of the widget
}
$("#numerictextbox").kendoNumericTextBox({
change: onChange
});
});
</script>
<style scoped>
.demo-section {
width: 400px;
}
</style>
</div>