Backbone.js的 - 什么是E1和$ EL之间的区别? [英] Backbone.Js - what's the difference between el and $el?
问题描述
所以我一直坚持了整个下午的<一个href=\"http://stackoverflow.com/questions/10638802/backbone-js-and-jqueryui-dialog-events-not-binding/10640233#10640233\">this问题我终于得到了解决。原来我被分配埃尔而不是$ EL。
So I've been stuck for the whole afternoon on this problem which I eventually solved. It turned out I was assigning el instead of $el.
有什么两个,当我应该使用每个人?
What's the difference between the two and when should I use each of them?
推荐答案
直接从文档, $ EL
是:
一个缓存的jQuery(或的Zepto)对象视图的元素。一个方便的参考,而不是重新包装的DOM元素的所有时间。
A cached jQuery (or Zepto) object for the view's element. A handy reference instead of re-wrapping the DOM element all the time.
因此, $ EL
是一个高速缓存,jQuery的(或的Zepto)版本EL
。如果您需要使用的报
任何的jQuery或的Zepto方法,你可以简单地使用 $ EL
,而不是包装报
在 $()
每次
So, $el
is a cached, jQuery (or Zepto) version of el
. If you need to use any jQuery or Zepto methods on el
, you can simply use $el
instead of wrapping el
in $()
each time.
这篇关于Backbone.js的 - 什么是E1和$ EL之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!