search

Home  >  Q&A  >  body text

javascript - How to set the first digit of the input box to not be zero

How to set the first digit of the input input box to not be zero

伊谢尔伦伊谢尔伦2803 days ago946

reply all(3)I'll reply

  • 世界只因有你

    世界只因有你2017-05-19 10:27:22

    Listen to the oninput event, use regular expression to determine whether the first digit is zero, and reset the input box if it is zero

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:27:22

    Bind the input event of the input box, get the value of the input box, take the first character of the string, and determine whether it is equal to 0

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:27:22

    1. Bind keyup event;

    2. Verify whether the content when the input content length is 1 is 0 (regular expressions can be used);

    3. Handling of different results.

    reply
    0
  • Cancelreply