Search code examples
kendo-uikendonumerictextbox

KendoNumericTextbox not updating when value set


I am having trouble updating kendoNumericTextBox when I update the val it will not show until I put my cursor into the textbox.

 $(document).ready(function () {
 
 $('#txtCorpEl').kendoNumericTextBox({}).data("kendoNumericTextBox");
 
 $('#txtCorpEl').value(5);
 
 $('#txtCorpEl').focus();
 
 //var numerictextbox = $("#txtCorpEl").data("kendoNumericTextBox");
//numerictextbox.focus();
 
 });
 
 
 function onChange() {
    console.log("event: change");
};
<link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css" rel="stylesheet"/>
<link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>        
<script src="http://cdn.kendostatic.com/2011.3.1129/js/kendo.all.min.js"></script>
 <input id="txtCorpEl" />


Solution

  • This is working fine when I test it.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
      <link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css" rel="stylesheet"/>
    <link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css" rel="stylesheet"/>
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>        
    <script src="http://cdn.kendostatic.com/2011.3.1129/js/kendo.all.min.js"></script>
    </head>
    <body>
     <input id="txtCorpEl" />
    <script>
        $(document).ready(function () {
            $("#txtCorpEl").kendoNumericTextBox();
         var numerictextbox = $("#txtCorpEl").data("kendoNumericTextBox");
     numerictextbox.value(5); 
     });
    </script>
    </body>
    </html>