对象不支持属性或方法’selectbox’
我正在使用来自http://www.bulgaria-web-developers.com/projects/javascript/selectbox/的selectbox jQuery插件。
我在js文件中也有一个链接,其中包含以下代码:
function loadTeams() { var responseArray, optionsOutput = ''; $.ajax({ type: "GET", url: "/ajax/team", dataType: "json", success: function (response) { responseArray = response.array; for (var i = 0; i < responseArray.length; i++) { optionsOutput += '' + responseArray[i] + ''; } $("#teamSelect").find('option') .remove() .end() .append(optionsOutput); $("#teamSelect").selectbox({ speed: 100 }); }, error: function (xhr, ajaxOptions, thrownError) { $("#teamSelect").find('option') .remove() .end() .append(''); } });
}
这适用于IE以外的所有浏览器。 在那里,我得到:
SCRIPT438:Object不支持属性或方法’selectbox’globals.js,第38行字符4
这相当于以下行:
$("#teamSelect").selectbox({ speed: 100 });
我甚至试过将整个jQuery插件js文件复制到globals.js
戏剧性和丑陋的方法,我仍然得到错误。
是什么赋予了?
编辑 – 更新:我已经尝试将#teamSelect
分配给var
并调用var.selectbox
,但是我得到了同样的错误。
啊哈,问题是jQuery的selectbox插件(可能是jQuery本身)和Foundation 4之间的冲突。当我集成Foundation 4时,我按照他们网站上的示例进行了复制并粘贴在这个神秘的位:
这是加载zepto或jquery,然后我从Google CDN加载jquery。 删除此行并放置我的jQuery jQuery首先解决了冲突。
- IE中的jQuery .live(’input)在删除文本时无法正常工作
- Internet Explorer中的JQuery选择器问题
- Javascript / jQuery outerHeight()
- jQuery.load(),混合HTTP / HTTPS和Internet Explorer
- 到达新窗口的内容。打开
- 当Internet Explorer开发人员工具栏可见时,JavaScript脚本仅适用于Internet Explorer
- 为什么我不能使用jQuery在IE中淡出这个表行?
- IE7 / 8的jQuery map()错误
- 如何阻止windows.onbeforeunload被IE中的javascript:href链接触发?