+ 1

I am trying to increase date by giving the input variable, Can anybody please help me out from this problem.??

<html> <body> <h2>Select a Date in first TextBox. Then click the Button to see how 3 days is added to this Date and shown in "Follow Date" TextBox.</h2> <p>Date: <input id="txtDate" type="text" onchange="getdate()"/> <input id="inputDate" type="text" value="" onchange="getdate()"/> </p> <p>Follow Date: <input id="follow_Date" type="text"/> </p> <script> $(document).ready(function () { $('#txtDate').datepicker(); $('#follow_Date').datepicker(); }); function getdate() { var tt = document.getElementById('txtDate').value; var date = new Date(tt); var newdate = new Date(date); var ddd = document.getElementById('inputDate').value; newdate.setDate(newdate.getDate() + ddd); var dd = newdate.getDate(); var mm = newdate.getMonth() + 1; var y = newdate.getFullYear(); var someFormattedDate = mm + '/' + dd + '/' + y; document.getElementById('follow_Date').value = someFormattedDate; } </script> <body> </html>

12th Jun 2017, 11:04 AM
Ritesh Kumar
Ritesh Kumar - avatar
2 Respuestas
+ 6
It seems like you have to include jQuery into your page
12th Jun 2017, 3:27 PM
SANYABEAST
SANYABEAST - avatar
+ 2
Present your code in Code Playground please.
12th Jun 2017, 11:21 AM
Calviղ
Calviղ - avatar