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

后端 未结 6 2055
轻奢々
轻奢々 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:39

    Easiest way is use read only attribute to prevent direct user input:

     
    

    Or you could use HTML5 validation based on pattern attribute. Date input pattern (dd/mm/yyyy or mm/dd/yyyy):

    
    

提交回复
热议问题