javascript - date format validation with jquery -
I am trying to validate the date format (from datepicker) if the date format is correct then false then the next step Go to Warning
if ($ ("# date"). Val ()! = (/ ^ \ D {2} \ / \ d {2} \ / \ d {4} $ /)) {$ ("#date"). CSS ('background-color', '# FF 20000'); } And {warnings ("good"); }
but this script does not work
Should:
if (! / ^ \ D {2} \ / \ d {2} \ / \ d {4} $ / test ($ ("# date"). Val ( )) {$ ("#date"). CSS ('background-color', '# FF 20000'); } And {warnings ("good"); }
You can assign a string to ==
or ! =
can not compare a RegExp object with operators, methods you have to use Reggae.
Comments
Post a Comment