简体   繁体   English

jQuery Mobile Datebox今天按钮单击关闭

[英]Jquery mobile datebox today button close on click

I'm using the jquery mobile datebox from here: http://dev.jtsage.com/jQM-DateBox/ and I am setting the calTodayButton to true. 我正在从此处使用jquery移动日期框: http ://dev.jtsage.com/jQM-DateBox/,并且将calTodayButton设置为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? 关于最佳方法的任何想法?

Try adding an click event to the button which closes the parent container like this 尝试在按钮上添加click事件,这样会关闭父容器

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

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();
});

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

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