Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datepicker textbox and submit button.The datepicker textbox defaultly shows the todays date.On click of submit button, I would like to set another date in datepicker textbox using Jquery.

It seems the jquery function working is fine.I am able to change the date.But It is automatically changing the date to default date which is in the datepicker textbox(inital value).

Please help!

What I have tried:

JQuery
function ValidateDate() {
    var sDate = $('#ScheduledDate').val();
    var sDateTo = $('#ScheduledDateTo').val();

   
    if (sDate == undefined || sDate == '') {
        alert("Please enter Scheduled Date.");
        return false;
    }
    else {
        
        var todaydate = $('#ScheduledDate').val();
        $('#ScheduledDateTo').datepicker('setDate', todaydate);
        return true;
    }

        
}


.cshtml
Posted
Comments
Karthik_Mahalingam 12-Jul-17 11:21am    
what is the format you are using?
priya9826 12-Jul-17 11:25am    
mm/dd/yyyy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900