Javascript Date Validation ( DD/MM/YYYY) & Age Checking

前端 未结 16 1642
遇见更好的自我
遇见更好的自我 2020-12-01 11:09

I\'ve started to work on Javascript recently. What I am testing is checking the DoB in valid format. Next step will be checking the age.

What my HTML code includes

16条回答
  •  心在旅途
    2020-12-01 12:08

    If you want to use forward slashes in the format, the you need to escape with back slashes in the regex:

    var pattern =/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;
    

    http://jsfiddle.net/P9TER/

提交回复
热议问题