두 개의 날짜 선택 도구와 새 행을 추가하는 옵션이있는 테이블이 있습니다. 문제는 datepicker가 작동하지 않는 새 행을 추가 할 때입니다. 행을 추가 할 때 Datepicker가 작동하지 않습니다.
나는 당신은 아마 새로 추가 된 요소datepicker()
호출되지 않은
https://jsfiddle.net/3uhkeq1h/2/
<script>
$(document).ready(function() {
$('.txtDate22').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'MM yy',
showButtonPanel: true,
onClose: function() {
var iMonth = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var iYear = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(iYear, iMonth, 1));
$(this).datepicker('refresh');
},
beforeShow: function() {
if ((selDate = $(this).val()).length > 0) {
iYear = selDate.substring(selDate.length - 4, selDate.length);
iMonth = jQuery.inArray(selDate.substring(0, selDate.length - 5), $(this).datepicker('option', 'monthNames'));
$(this).datepicker('option', 'defaultDate', new Date(iYear, iMonth, 1));
$(this).datepicker('setDate', new Date(iYear, iMonth, 1));
}
}
});
$(".txtDate22").focus(function() {
$(".ui-datepicker-calendar").hide();
$("#ui-datepicker-div").position({
my: "center top",
at: "center bottom",
of: $(this)
});
});
$(".txtDate22").blur(function() {
$(".ui-datepicker-calendar").hide();
});
});
</script>
변경 사항을 잘 모르시겠습니까? –
@ anatp_123 업데이트 된 jsfiddle –
음을 확인하십시오.이 말은 https://jsfiddle.net/3uhkeq1h/2/입니다. –