を動作しません、私はjQueryのUI-日付ピッカーを追加しようとしていると私は、イベントハンドラの作業を取得することはできません。jQueryのイベントハンドラは
$('.ui-datepicker').on('click', 'a.ui-datepicker-next', 'a.ui-datepicker-prev', function(event) {
event.preventDefault();
console.log("CLICK");
});
私は何もログを持っています私がリンクをクリックするとコンソール。ここにhtmlがあります:
<div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"...>
<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix- ui-corner-all">
<a class="ui-datepicker-next ui-corner-all"...></a>
<a class="ui-datepicker-prev ui-corner-all"...></a>
...
これを引き起こすイベントハンドラとして何を配置する必要がありますか? jQueryは、私のhtmlのフッタの<script>jQuery here</script>
にあります。
EDIT:リンクが正しくありませんでした - a.ui-datepicker-month
とa.ui-datepicker-year
a.ui-datepicker-next
とa.ui-datepicker-prev
に変更おかげ
は、構文を訂正:これを試してみてください。まだコンソールにはログオンしていません.... @Rory McCrossan –
あなたのコードには特に問題はありません。この問題は、イベントがどのようにアタッチされているかで決める必要があります上記のコードを実行すると '.ui-datepicker'要素が存在しますか?テストでは、 '$( '.ui-datepicker')'を '$(document)'に置き換えてみてください –
編集中の ''のどちらの要素も 'ui-datepicker-month'や' ui-日付ピッカー年...? –