Skip to content

Instantly share code, notes, and snippets.

@shohag-cse-knu
Created September 10, 2018 11:25
Show Gist options
  • Save shohag-cse-knu/e7602f240528410e80916bda4cbfd1e3 to your computer and use it in GitHub Desktop.
Save shohag-cse-knu/e7602f240528410e80916bda4cbfd1e3 to your computer and use it in GitHub Desktop.
Jqxvalidator birth date validation
<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