$( "#dateField" ).datepicker({
changeMonth: true,
changeYear: true,
buttonImage: "images/calander.png",
buttonImageOnly: true,
yearRange: "-100:+0",
maxDate: '-1d',
dateFormat: "dd-mm-yy",
onSelect: function(dateText)
{
document.getElementById("dateFieldError").style.display='none';
var x=$( "#dob" ).val();
var y=dateText;
split_dob = x.split('-');
var formatted_dob = new Date();
formatted_dob.setFullYear(split_dob[2], split_dob[1]-1, split_dob[0]);
split_dateField = y.split('-');
var formatted_dateField = new Date();
formatted_dateField.setFullYear(split_pid[2], split_pid[1]-1, split_pid[0]);
if(formatted_dob > formatted_dateField)
{
alert("Date cannot be less than birth date.");
$( "#dateField" ).val('');
}
}
})
changeMonth: true,
changeYear: true,
buttonImage: "images/calander.png",
buttonImageOnly: true,
yearRange: "-100:+0",
maxDate: '-1d',
dateFormat: "dd-mm-yy",
onSelect: function(dateText)
{
document.getElementById("dateFieldError").style.display='none';
var x=$( "#dob" ).val();
var y=dateText;
split_dob = x.split('-');
var formatted_dob = new Date();
formatted_dob.setFullYear(split_dob[2], split_dob[1]-1, split_dob[0]);
split_dateField = y.split('-');
var formatted_dateField = new Date();
formatted_dateField.setFullYear(split_pid[2], split_pid[1]-1, split_pid[0]);
if(formatted_dob > formatted_dateField)
{
alert("Date cannot be less than birth date.");
$( "#dateField" ).val('');
}
}
})
No comments:
Post a Comment