Created
September 10, 2018 11:25
-
-
Save shohag-cse-knu/e7602f240528410e80916bda4cbfd1e3 to your computer and use it in GitHub Desktop.
Jqxvalidator birth date validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//... | |
{ input: '#date_of_birth', message: 'invalid!', action: 'keyup,blur,change', rule: function(input,commit){ | |
if(input.val()==''){return true} | |
else | |
{ | |
var mydate = new Date(); | |
var year = mydate.getFullYear(); | |
year -= 18; | |
var month = parseInt(mydate.getMonth())+1 | |
var dateStr = mydate.getDate()+'/'+month+'/' + year; | |
return !validate(dateStr,input.val()); | |
} | |
} | |
} | |
//... | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment