Home › Forums › JavaScript › Code school – plugin implementation › Reply To: Code school – plugin implementation
October 13, 2014 at 3:18 pm
#186144
Participant
I think Kuzyo was asking why:
this.each(function() {
…part of the code worked when:var vacation = this;
…didn’t.
This is just a misunderstanding about this
. this
is the context that the current function is executing in. In the this.each
part, this
is the jQuery plugin. In the iterating function, however, this
is the individual DOM element that the jQuery object passes in.
Another example of why you need to learn javascript and not just jQuery. (Not accusing you of this; just a general observation.)