jquery ui datepicker setDate bug
Show how calling setDate on a none-focused datepicker change context of an open datepicker
by silversailor
HTML
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<div>
<p>
focusing the first date field and selecting a date in the calendar then display will always result in changing the second input, due to the "beforeShow" function provided.
</p>
<input type="text" id="date_1" class="date-field"/>
<input type="text" id="date_2" class="date-field"/>
</div>
JavaScript
$(".date-field").datepicker();
$("#date_1").datepicker("option","beforeShow",function(){
setTimeout(function(){
$("#date_2").datepicker("setDate", new Date("2013-08-06") );
});
});