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?
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?
Share Improve this question edited May 23, 2017 at 12:13 CommunityBot 11 silver badge asked May 17, 2012 at 17:11 reach4thelasersreach4thelasers 26.9k23 gold badges94 silver badges125 bronze badges1 Answer
Reset to default 20Straight from the documentation, $el
is:
A cached jQuery (or Zepto) object for the view's element. A handy reference instead of re-wrapping the DOM element all the time.
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.