jQuery UI-无法在模式对话框中更改日期选择器中的月份/年份 [英] JQuery UI - Cannot change month/year in datepicker within Modal Dialog

查看:117
本文介绍了jQuery UI-无法在模式对话框中更改日期选择器中的月份/年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

模态对话框中使用 Datepicker ,不使用Firefox 19.0.2中的 Change Month/Year (更改月份/年份)下拉菜单,请参见:

http://jsfiddle.net/469zV/2/

HTML

<div id="dialog-form" title="test" style="display:none">
  <form>
     <fieldset>
        <p>Date1: <input type="text" id="datepicker"/></p>  
     </fieldset>
  </form>
</div>

脚本

$( "#dialog-form" ).dialog({
    modal: true
});

$("#datepicker").datepicker({
    changeMonth: true,
    changeYear: true
});

经过大量搜索,可以找到有关此问题的一些信息,但与解决方案无关:

http://bugs.jqueryui.com/ticket/8989#no1

任何想法如何解决此问题……谢谢.

解决方案

这可能与您所寻找的不完全相同,但是如果您删除文本输入,它将为您提供月份和年份的选择.

工作示例

$( "#dialog-form" ).dialog({  
    modal:true,
    height:340,
    width:340
});

$("#datepicker").datepicker({
    changeMonth: true,
    changeYear: true,

});

<div id="dialog-form" title="test" style="display:none"> 
    <form>
    <fieldset> 
        <div id="datepicker"/></div>  
    </fieldset>
    </form>
</div>

Using Datepicker inside a modal Dialog, don't work the Change Month/Year dropdown in Firefox 19.0.2 see:

http://jsfiddle.net/469zV/2/

HTML

<div id="dialog-form" title="test" style="display:none">
  <form>
     <fieldset>
        <p>Date1: <input type="text" id="datepicker"/></p>  
     </fieldset>
  </form>
</div>

SCRIPT

$( "#dialog-form" ).dialog({
    modal: true
});

$("#datepicker").datepicker({
    changeMonth: true,
    changeYear: true
});

After search a lot can find some info about this problem but nothing about solution:

http://bugs.jqueryui.com/ticket/8989#no1

Any idea how to solve this... thanks in advanced.

解决方案

This may not be exactly what you were looking for, but if you drop the text input, it will give you the month and year selection back.

Working Example

$( "#dialog-form" ).dialog({  
    modal:true,
    height:340,
    width:340
});

$("#datepicker").datepicker({
    changeMonth: true,
    changeYear: true,

});

<div id="dialog-form" title="test" style="display:none"> 
    <form>
    <fieldset> 
        <div id="datepicker"/></div>  
    </fieldset>
    </form>
</div>

这篇关于jQuery UI-无法在模式对话框中更改日期选择器中的月份/年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆