I’m creating a date range picker in jQuery and tie it to an input text field.
the code goes like this:
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
</head>
<body style="font-size:62.5%;">
<form action="sample.php" method="post">
Start Date: <input type="text" name="startdate" id="datepicker"/>
End Date: <input type="text" name="enddate" id="datepicker"/>
<input type="submit" />
</form>
</body>
</html>
Data seems to be working FOR the START DATE input text field. When I select the start date field, the calendar appears:

But when I click on the END DATE input text field, the calendar never appears. I need to select dates START and END by using that calendar.
Something must be wrong on my code. Can anyone tell me?
Thanks!
Hiya So you have 2 element start and end date with same
id = datepickerwhich is incorrect.see this for example: http://jsbin.com/evudo
Solution:
Please initialize for both the input boxes,
HTML
Hope it helps,
cheers