Keydown event issue on HTML textbox

前端 未结 4 864
清歌不尽
清歌不尽 2021-01-15 03:05

I have a field that accepts the year, so I have created

input type=\"number\" 

and implemented keydown event to restrict

4条回答
  •  感情败类
    2021-01-15 03:43

    May be this will work , you can use the Regular Express to validate only number and

    ^[0-9\.\-\/]+$
    

    and also you can use the .length method to insure that you have specific length

提交回复
热议问题