Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

how to handle maxlength of numberic input

  • i use ons-input in my form and need to have number type attribute for some of them. but unfortunately it couldn’t handle maxlength. this is my code :

    <ons-input class="txt" maxlength="5" type="number" placeholder="Cell Number" input-id="txtRecover" />

  • Onsen UI

    @meisam3322 Hello!

    Copy-pasting from the other place where you also asked this:

    @meisam3322 That’s how HTML5 works. But Google and SOF have a bunch of solutions for you.

    Basically, you can use min and max attributes to specify a range and oninput event if you want to check the length.

    However, if what you are trying to do is to write a telephone number input, maybe you can use type="tel" and keep using max-length.