简体   繁体   English

jQuery Datepicker未检测到onselect的自定义功能

[英]JQuery Datepicker not detecting onselect for custom function

I'm trying to detect the select of a jquery datepicker. 我正在尝试检测对jquery datepicker的选择。 but it does not seem to work. 但它似乎不起作用。 It does not give any errors but does not execute the function. 它不会给出任何错误,但不会执行该功能。

HTML HTML

<div id="datepicker" class="datepicker-tafeltje"></div>

JS JS

$(document).ready(function(){
    $("#datepicker").datepicker({
     onSelect: refreshOptions
  });
});

I have also tried this 我也尝试过

$(document).ready(function(){
  $("#datepicker").datepicker({
    onSelect: function(){console.log('test')}
  });
});

But this does not log anything either! 但这也不记录任何东西!

Seems it is a problem in mapping! 似乎是映射问题! Thank you all for the answers 谢谢大家的回答

You should use this:: 您应该使用以下命令:

$("#datepicker").datepicker({ 
    afterAdjustDate: function(i,o,p){
       console.log('test');
    }
});

OR 要么

$("#datepicker").datepicker({
     onSelect: function(e) {
         console.log('test');
     }
 });

Try following code 尝试以下代码

 $(document).ready(function() { $("#datepicker").datepicker({ onSelect: function(e) { alert(e); } }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.11.3/jquery-ui.min.js" integrity="sha256-xI/qyl9vpwWFOXz7+x/9WkG5j/SVnSw21viy8fWwbeE=" crossorigin="anonymous"></script> <div id="datepicker" class="datepicker-tafeltje"></div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM