I have an issue where the calendar is being fired when another field is clicked, although the selector in the datepicker config is different. I have a click handler assigned to the "Place Order Now" radio button that clears the text field of any previously chosen date and disables input of a date but it is also firing the datepicker.
I've also tried to think of different ways to clear/disable entry to the text field that would alleviate the need for a click event on the "place Order Now" radio button, which obviously fixes the initial issue but no longer clears/disables the field.
Using firebug, I verified that the datepicker click event is not bound to the "place Order Now" radio button, i've tried to exclude the "place Order Now" radio button from the datepicker config using .not(), targeting by input type, checked overall page for validation/jsLint issues and have stumped some resident jquery gurus so I am at my wits end.
<head><script type="text/javascript">
$(function() {
$("input.autoShipDateEntry").datepicker({ minDate: "+7D", maxDate: "+90D" });
});
</script>
</head>
<body>
<div class="autoShipOptions">
<p class="orderNow"><input type="radio" checked="checked" value="PlaceOrderDateNow"><label>Place Order Now</label></p>
<p id="autoShipDatePickerContainer" class="autoShipDatePicker">
<input type="radio" value="PlaceOrderDateLater"><label>Ship Order On:</label><br>
<input type="text" size="10" class="autoShipDateEntry hasDatepicker"">
</p>
</div>
<script type="text/javascript">
$(document).ready(function() {
if ($('p.orderNow input').is(':checked')) {
$('input.autoShipDateEntry').attr('disabled', true);
} else {
$('input.autoShipDateEntry').removeAttr('disabled');
}
//disable/enable autoship datepicker div
$("p.orderNow input").click(function(){
$("input.autoShipDateEntry").focus().val('');
$('input.autoShipDateEntry').attr('disabled', true);
});
$(".autoShipDatePicker input").click(function(){
$('input.autoShipDateEntry').removeAttr('disabled');
});
</script>
</body>
Any help is greatly appreciated. Love jquery but still honing my debugging skillz.