title: How can I set the value of textbox to 0 if blank or empty?
body: <p>I have the following snippet in my js file: </p>
  
  <pre><code>if ($("#LengthenCheckBox").is(":checked")) {
                  $("#Length").data(kendoTextBox).enable(true);
  
                  //If Lengthening field is blank, default to zero
                  if ($("#Length").data(kendoTextBox) == "") {
                      $("#Length").data(kendoTextBox).value("0");
                  };
  
                  document.getElementById("Lengthen").value = true;
  else {
  
              if ($("#Length").data(kendoTextBox) == "") {
                  $("#Length").data(kendoTextBox).value("0");
              }
              else {
                  $("#Length").data(kendoTextBox).value();
              }
              $("#Length").data(kendoTextBox).enable(false);
  </code></pre>
  
  <p>However, I just want the value of the textbox to equal 0 if no value is entered or the textbox is blank. How can I adjust the following above? </p>
  
  <p>EDIT: </p>
  
  <p>How can I set the value of textbox to 0 if blank or empty?</p>
  
  <p>That is I have a simple textbox, if the user enters no value inside the textbox or the user leaves the textbox blank and goes somewhere else, I want it to automatically default back to 0 and not blank! I never want the textbox to be blank but contain some value whether it's 0 or any other integer value but never blank. </p>
  
  <p>Hope this helps! </p>