0
我試圖檢測從datetime選擇器中選擇日期後更改的文本框內容。在日期選擇後檢測文本框的內容已更改
我的代碼是這樣的 -
<div class="display-flex">
@Html.TextBoxFor(m => m.DateOfLastSight, "{0:dd/MM/yyyy}", new { @class = "form-control", autocomplete = "off", placeholder = "dd/mm/yyyy", maxlength = 10, id = "txtLastSightTestDate" })
<button type="button" class="btn-datepicker" id="cal" onclick="ShowCalander('txtLastSightTestDate')">
<em class="fa fa-calendar" aria-hidden="true"></em>
</button>
</div>
jQuery代碼 -
那function ShowCalander(CalenderId) {
$('#' + CalenderId).datepicker({
format: "dd/mm/yyyy",
autoclose: true
});
$('#' + CalenderId).trigger('focus');
}
事件檢測文本
$('#txtLastSightTestDate').on('propertychange change keyup paste input', function() {
// do your stuff
$('input[type="checkbox"]').prop('checked', false);
});
該功能捕捉所有事件,除了一個變化時間,當我從日期選擇器中選擇一個日期。
有沒有其他方法可以捕獲這部分?