Tuesday, 21 July 2015

check date validation in jquery

var sdate = $('#StartDate').val().split('/');

var sday = sdate[1];

var smon = sdate[0];

var syear= sdate[2];

var edate = $('#EndDate').val().split('/');

var eday = edate[1];

var emon = edate[0];

var eyear= edate[2];

var scdate = new Date(syear, smon, sday);

var ecdate = new Date(eyear, emon, eday);

if (ecdate < scdate)



{

$('#EEnddate').css("color", "red");

$('#EEnddate').text('you can not select enddate as past date.')



}

No comments:

Post a Comment