0
我写这样的类型错误:document.observe是不是在我的js文件中的函数
document.observe("dom:loaded", function() {
add();
});
但它显示错误类型错误:document.observe不是一个函数
我使用的轨道3 &的jQuery-UI-1.10.0
任何一个可以告诉我为什么我得到这样的吗?
在此先感谢
我写这样的类型错误:document.observe是不是在我的js文件中的函数
document.observe("dom:loaded", function() {
add();
});
但它显示错误类型错误:document.observe不是一个函数
我使用的轨道3 &的jQuery-UI-1.10.0
任何一个可以告诉我为什么我得到这样的吗?
在此先感谢
由于rails 3使用jquery,你正在写代码的原型。这可能会造成问题。
因此,尝试转换代码jQuery中。你的代码可能看起来像。
$(document).ready(function() {
// Run code
});
但低于考虑并进行更改根据自己的需要
$(window).load(function(){
// Run code ##It will run the js after the whole page is loaded.
});
$(document).ready(function(){
// Run code ##It will run the js just after the loading of DOM.
});
感谢您的帮助:-) – 2014-09-23 11:50:28
的http://stackoverflow.com/questions/1907702/document-observedomloaded-function – 2014-09-23 10:36:28
它也表现出同样可能复制错误类型错误:$(...)观察是不是一个函数 – 2014-09-23 10:46:17