Search and Top Navigation
#4783 closed bug (notabug)
Opened August 15, 2009 04:42AM UTC
Closed August 26, 2009 02:44AM UTC
Last modified October 11, 2012 09:15PM UTC
datepicker and duplicate ids
Reported by: | mbreaton | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.datepicker | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If a page contains elements with the same id and datepicker is assigned to both, selected dates are filled into the first element, even though the date picker drop down appears near the correct element.
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.date
{
}
</style>
<script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.date').datepicker();
});
</script>
</head>
<body>
<form method="post" action="#">
<input type="text" class="date" id="date1" name="date" /><br />
<input type="text" class="date" id="date2" name="date" /><br />
<input type="submit" value="save" />
</form>
<form method="post" action="#">
<input type="text" class="date" id="date1" name="date" /><br />
<input type="text" class="date" id="date2" name="date" /><br />
<input type="submit" value="save" />
</form>
</body>
</html>
It's not valid to have multiple elements with the same id.