此问题已被提出,但结果不同。 人们在模式对话框中使用日期选择器并使日期选择器显示(使用z-index属性)时遇到了麻烦。
但是我只是简单地复制了用于使得datepicker工作的js从脚开始工作,但是在模式弹出窗口的视图中。然后显示日期选择器,但不会使用所选日期填充选定的输入框。
我的代码在其他地方有效:
$('#datepicker').datepicker({ dateFormat: 'yy-mm-dd' });
并且模态对话框类中的输入是datepicker。
我不确定我要求的解决方案是什么。因为该函数无处不在,并且确实显示(建议jquery正在工作)但只是没有用所选日期填充输入框.... 有任何想法吗? ........
function modalfollow()
{
$('<div>').dialog({
title: 'Add Follow',
height: '350',
width: '400',
open: function ()
{
$(this).load('<?=base_url();?>leads/add_follow/<?=$this->uri->segment(3);?>/');
},
modal: true
});
// return false so <a> or <button> doesnt fire + reload page
return false;
}
这会加载加载视图的模式框。
在此级别,datepicker不起作用。
答案 0 :(得分:2)
我不确定你是如何设置你的代码但是我没有任何努力工作在这个小提琴中。你有更新面板吗?
<强>标记强>
<div id="dialog" title="Basic dialog">
<input type="text" class="datepicker" /></div>
<button id="opener">Show</button>
<强>的Javascript 强>
$(function () {
$(".datepicker").datepicker({
dateFormat: 'yy-mm-dd'
});
$("#dialog").dialog({
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
}
});
$("#opener").click(function () {
$("#dialog").dialog("open");
});
});