Jquery mobile datebox today button close on click

帅比萌擦擦* 提交于 2019-12-11 18:09:17

问题


I'm using the jquery mobile datebox from here: http://dev.jtsage.com/jQM-DateBox/ and I am setting the calTodayButton to true. The problem I have is when I click the button it just selects today's date which is fine but I also want it to close on click. Any ideas as to the best way to do this?


回答1:


Try adding an click event to the button which closes the parent container like this

$('.ui-datebox-controls').find('a.ui-btn').on("click",function(){
    $(this).parent().parent('.ui-datebox-container').hide();
 });



回答2:


The accepted solution didn't work for me, but this one did:

$('.ui-datebox-controls').find('a.ui-btn').live( 'click', function(){
    $(this).parent().parent().parent().parent('.ui-datebox-container').hide();
});


来源:https://stackoverflow.com/questions/9815613/jquery-mobile-datebox-today-button-close-on-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!