javascript – 在jQuery datepicker上聆聽onChange?
我目前正在建立一個這樣的日期選擇器
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> <input id="datepicker" type="datepicker" name="date" placeholder="Date" />
JS
$('#datepicker').datepicker() .on("change", function (e) { console.log("Date changed: ", e.target.value); });
我的目標是能夠在使用者清除日期框時收聽.但是,一旦您將日期框重新放大,更改事件似乎就會觸發.我想知道是否有方法來監聽jQuery日期框中的所有更改,或者是否有更好的選擇.
JsFiddle連結
ofollow,noindex" target="_blank">https://jsfiddle.net/szkfm0y7/input
上使用jquery以及更改事件$('#datepicker').datepicker() .on("input change", function (e) { console.log("Date changed: ", e.target.value); });
程式碼日誌版權宣告:
翻譯自:http://stackoverflow.com/questions/30132747/listening-to-onchange-on-a-jquery-datepicker