Kendo UI Numeric Textbox - Max Value

13,661

Use the maxLength attribute of the input. So, on page load, do the following:

$("#XXXX").attr('maxlength','5');

Edit based on comments : In order to apply rule to all numeric boxes, the following should work:

$("input[data-role='numerictextbox']").attr('maxlength','5'); 
Share:
13,661
Mark
Author by

Mark

User Interface designer, developer and C#,.NET & SQL programmer. https://www.linkedin.com/pub/mark-roberts/17/62/445

Updated on July 10, 2022

Comments

  • Mark
    Mark almost 2 years

    I'm using the Kendo UI Numeric Textbox. I have a max value set on the text box. However, I want the max value to work more like max-char attribute.

    Currently, if I type in anything past 99999, say 111111, it reverts to max value (99999), I would rather the textbox just prevent additional numbers than to revert to 9999.

      @(Html.Kendo().NumericTextBox<double>()
                    .Name("XXXX")
                    .Max(99999)
                    .Min(1)
                    .Format("\\#")
                    .HtmlAttributes(new { style="width:100%"})
                )