Hi everyone, I’m doing an ajax call in a partial with a datepicker that loads data in a div container. Everything works fine except when it returns I have two datepickers on the form. One with the select button and the other without. I would like to only one datepicker on the form. How can I prevent two datapickers from being displayed after a successful ajax call?
Here’s the script I’m using.
<script type="text/javascript">
$(document).ready(function () {
$("#datep").datepicker({ showOn: "both", buttonText: "Select Date", changeMonth: true, changeYear: true, yearRange: "-2:+2", showOtherMonths: true, onSelect: function (date, datepickder) {
var sltdDate = { selectedDate: date };
$.ajax({
type: "GET",
url: "/Schedule/GetSchedule",
data: sltdDate,
datatype: "html",
success: function (data) {
$("#returnedData").html(data);
}
});
}
});
});
</script>
<div id="dateContainer">
<input type="date" name="date" id="datep" value="Select Date">
</div>
<div id="returnedData">
//table of data returned here
</div>