hae、作業して$(document).on('click','',function(){});
いますが、以下は私のコードです。
<script type="text/javascript">
$(function () {
$(document).on('click', '.date-picker', function () {
$(this).datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'MM yy',
onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
});
});
</script>
table_html = '<td style="min-width: 200px;"><input name="' + control_id + '" id="' + control_id + '" value="' + row_val + '" type="date" data-role="datebox" data-options=\'{"mode": "calbox", "useClearButton": true}\' ></td>';
$('#variables').append(table_html);
上記のコードは、月年ピッカーを作成します。それは正常に動作します。
しかし、初めてクリックすると、月ピッカー コントロールは何もしません。その外側をクリックしてもう一度クリックすると、うまくいきました。
初めてのクリックでクリックイベントがどのように検出されるかについてのアイデアや提案は高く評価されます