HTML5 pattern for formatting input box to take date mm/dd/yyyy?

后端 未结 6 2082
轻奢々
轻奢々 2020-12-28 15:25

I used jQuery datepicker and I want to restrict my input field with a HTML5 pattern if a user, instead of getting the date from jQuery datepicker, types the date.

H

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-28 15:28

    pattern="[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}"

    This is pattern to enter the date for textbox in HTML5.
    The first one[0-9]{1,2} will take only decimal number minimum 1 and maximum 2.
    And other similarly.

提交回复
热议问题