Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Respected sir,
Can you please show me the html and corresponding javascript code for validate start date and end date include datepicker... i tried but dont know how to write js code... my html code is
HTML
<html>
<body>
<script language="javascript" src="date.js"></script>
<tr>
	<td> StartDate </td>
	<td><input type="date" id="startdate" name="startdate" />
    </td>
</tr>
<tr>
    <td> EndDate</td>
	<td> <input type="date" id="enddate" name="enddate" />
    </td>
</tr>
<table><tbody><tr>
	<button type="button"  önclick="javascript:message()">Submit</button>
</tr></tbody></table>

</body>
</html>  

please reply as soon as possible.. awaiting for your reply...


Regards,
Gowtham.V
Posted
Updated 25-Sep-12 1:08am
v2

1 solution

SQL
function checkDOJ(sender, args) {
               if (sender._selectedDate < new Date()) {
                   alert("You cannot select a day earlier than today!");
                   sender._selectedDate = new Date();
                   // set the date back to the current date
                   sender._textbox.set_Value(sender._selectedDate.format(sender._format))
               }
           }

           function checkDOB(sender, args) {
               if (sender._selectedDate > new Date()) {
                   alert("You cannot select a day Greater than today!");
                   sender._selectedDate = new Date();
                   // set the date back to the current date
                   sender._textbox.set_Value(sender._selectedDate.format(sender._format))
               }
 
Share this answer
 

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