jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了为什么jQuery UI datepicker在jQuery对话框模式中工作?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的一个文本输入中使用jQuery UI datepicker.这是一个对话模式.

实际上,我可以在正常的文本输入中调用datepicker,并且我正常收到我的日历,但是我不能在对话框模式文本输入中(在模态文本输入中碰巧,没有任何JavaScript错误之后).

这是我的代码调用datepicker:

$(function() {
    $("#myTexTinputID").datepicker({ dateFormat: 'dd/mm/yy' });
);

我尝试更改css .ui-datepicker Z-index@L_801_7@,但我仍然没有.

你有提示解决这个问题吗?

问候,

在my_page.html我有

function openSaisieARModal()
        {
            window_SELEct_CodeAgence = new showModalWindow('SaisieARModal',500);
        }

我使用这个脚本

var showModalWindow=function(id,width)
{
    var newId=id+'Copy';
    this.id=newId;

var prevIoUsnode=document.getElementById(newId);
if(prevIoUsnode!=null)
{
    prevIoUsnode.parentNode.removeChild(prevIoUsnodE);
}

var rootNode=document.getElementsByTagName('body')[0];
this.node=document.createElement("div");
rootNode.appendChild(this.nodE);
this.node.setAttribute('id',newId);
this.node.setAttribute('title',document.getElementById(id).getAttribute('title'));
this.node.innerHTML=document.getElementById(id).innerHTML;
if(width==null)
{
    width=400;
}
$('#'+newId).dialog({autoOpen: true,modal: true,width:width });

this.closeWindow=function()
{
    $('#'+this.id).dialog('close');
}

this.centerContent=function()
{
    this.node.style.textAlign='center';
}

this.center=function()
{
    $('#'+this.id).dialog('option','position','center');
}

}

这是my_page.html中的模态HTML代码

<div style="display:none;">
        <div id="SaisieARModal" title="DATE">
            <table class="tableFrame" cellspacing="0px" width="100%">
                <tr>
                    <td class="topLeft">

                    </td>
                    <td class="topCenter">

                    </td>
                    <td class="topRight">

                    </td>
                </tr>
                <tr>
                    <td class="middleLeft">

                    </td>
                    <td class="middleCenter">
                        <table>
                            <tr align="center">
                                <td>
                                    Date
                                </td>
                                <td>
                                    <input id="myTexTinputID" type="text"  />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td class="middleRight">

                    </td>
                </tr>
                <tr>
                    <td class="bottomLeft">

                    </td>
                    <td class="bottomcatenter">

                    </td>
                    <td class="bottomRight">

                    </td>
                </tr>
            </table>
            <div>
            </div>
        </div>
</div>
var prevIoUsnode=document.getElementById(newId); if(prevIoUsnode!=null) { prevIoUsnode.parentNode.removeChild(prevIoUsnodE); } var rootNode=document.getElementsByTagName('body')[0]; this.node=document.createElement("div"); rootNode.appendChild(this.nodE); this.node.setAttribute('id','center'); }<div style="display:none;"> <div id="SaisieARModal" title="DATE"> <table class="tableFrame" cellspacing="0px" width="100%"> <tr> <td class="topLeft"> </td> <td class="topCenter"> </td> <td class="topRight"> </td> </tr> <tr> <td class="middleLeft"> </td> <td class="middleCenter"> <table> <tr align="center"> <td> Date </td> <td> <input id="myTexTinputID" type="text" /> </td> </tr> </table> </td> <td class="middleRight"> </td> </tr> <tr> <td class="bottomLeft"> </td> <td class="bottomcatenter"> </td> <td class="bottomRight"> </td> </tr> </table> <div> </div> </div> </div>

解决方法

我嘲笑了一个很好的例子.您尝试更改ui-datepicker上的z-index,但是在查看Firebug中的呈现代码后,它看起来像您想要的id是ui-datepicker-div.我将z-index设置为9999,它@L_673_23@在模态对话框的顶部.
<script type='text/javascript'> 
  $(function() {
      $("#datepicker").datepicker({ dateFormat: 'dd/mm/yy' });
  });

  function openmodal() {   
      var $dialogContent = $("#event_edit_container");       

      $dialogContent.dialog({
         modal: true,title: "Test",close: function() {},buttons: {
          save : function() {},cancel : function() {}
         }
      }).show();
      $("#ui-datepicker-div").css("z-index","9999");   
  }
</script>

<div ><a href="javascript:openmodal();">Open modal</a></div>
<div id="event_edit_container" >
    <form>
        Date: <input type="text" id="datepicker" name="datepicker">
    </form>
</div>

大佬总结

以上是大佬教程为你收集整理的为什么jQuery UI datepicker在jQuery对话框模式中工作?全部内容,希望文章能够帮你解决为什么jQuery UI datepicker在jQuery对话框模式中工作?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。