我正在开发一个asp.net页面/应用程序。我创建了一个文本框,我使用jqueryui中的datepicker设置为日期选择器。在firefox和chrome中,datepicker不呈现。在IE9中,日期选择器呈现,如果我忽略错误。错误在jquery.ui.datepicker.js的第644行。
抛出错误的代码就在这里。
inst.dpDiv.zIndex($(input).zIndex()+1);
这是VS在捕获错误时显示的消息
Microsoft JScript运行时错误:对象不支持此属性或方法
我不确定是什么导致了这个问题。我已经找到了zindex问题,我发现的那些与其他元素后面出现的对话有关。我没有发生这种情况。
答案 0 :(得分:26)
添加jquery.ui.core.js
即可
答案 1 :(得分:7)
我遇到了同样的问题并通过确保我引用了最新的jQuery和jQuery UI来修复它。
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
答案 2 :(得分:3)
.zIndex()不是jQuery方法(搜索jQuery API,没有任何内容)
你应该使用.css('z-index','100')
还附注:
每当在ASP .NET中工作时,我都不使用$ sign来访问jQuery我使用
inst.dpDiv.zIndex(jQuery(input).zIndex()+1);
根据您使用Win Forms,MVC等的ASP .NET框架,内置的MSFT Ajax可能会与jQuery冲突。
答案 3 :(得分:2)
使用此:
$.zIndex = $.fn.zIndex = function (opt) {
var def = { inc: 10, group: "*" };
$.extend(def, opt);
var zmax = 0;
$(def.group).each(function () {
var cur = parseInt($(this).css('z-index'));
zmax = cur > zmax ? cur : zmax;
});
if (!this.jquery)
return zmax;
return this.each(function () {
zmax += def.inc;
$(this).css("z-index", zmax);
});
}
答案 4 :(得分:1)
我包含(核心文件),
ui.css and ui.core.js files
它对我有用..
答案 5 :(得分:0)
Axel22给出了正确的答案来解决这个问题。
这是因为jquery-ui-datepicker.js脚本依赖于jquery-ui-core.js脚本。
在jQuery Datepicker Documentation页面的“概述”标签中,右侧有一个依赖项列表。
答案 6 :(得分:0)
添加脚本引用(../Scripts/jquery.ui.core.js)它将起作用 请参阅jquery.ui.core.js库
答案 7 :(得分:-1)
这是我的解决方案:
//inst.dpDiv.zIndex(jQuery(input).zIndex()+1); //we don't need it anymore
$.zIndex = '30000'; // i set the zindex at the higher value