大佬教程收集整理的这篇文章主要介绍了Rails 3 JQuery page.insert_html和TypeError:Element.insert不是函数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#photo =render 'shared/photo' = link_to_function "Add a Photo" do |page| | page.insert_html :bottom,'photo',:partial => 'shared/photo',:object => Photo.new | end |
所以生成的Javascript是:
try { Element.insert("photo",{ bottom: "Data\n\n" }); } catch (E) { alert('RJS error:\n\n' + e.toString()); alert('Element.insert(\"photo\",{ bottom: \"Data\\n\\n\" });'); throw e }; return false;
在rails docs中,insert_html是一个Prototype帮助器,但我认为用https://github.com/rails/jquery-ujs替换Rails.js会替换JQuery帮助器的这个帮助器.我得到一个TypeError.ElemenTinsert不是一个函数.
难道我做错了什么 ?或者我是否会在没有帮助者的情况下自己做这件事?
与rails-ujs不同,jquery-ujs不与rjs支持捆绑在一起.有一个单独的gem提供了名为jrails的功能.
We’ve talked about merging the two projects,但决定将它们分开,因为它更灵活.
以上是大佬教程为你收集整理的Rails 3 JQuery page.insert_html和TypeError:Element.insert不是函数全部内容,希望文章能够帮你解决Rails 3 JQuery page.insert_html和TypeError:Element.insert不是函数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。