jquery datepicker onselect event handler multiple times

一个人想着一个人 提交于 2019-12-05 05:11:37

The code you're using is just replacing the first onSelect handler with the second. If you want to do two things, then you'll need to first get the existing onSelect handler then call it from within the handler that you are replacing it with.

$(function() {
     $('.test').datepicker();
     $('.test').datepicker('option', 'onSelect', function(dateText,inst) { alert('one'); } );
     var prevHandler = $('.test').datepicker('option','onSelect');
     $('.test').datepicker('option', 'onSelect', function(dateText,inst) { prevHandler(dateText,inst); alert('two'); } );
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!