I am watching jQuery lessons on
https://tutsplus.com/course/30-days-to-learn-jquery/. And I am stuck on the lesson
Slides and Structure starting 9.20 minute. This is a simplified code from the video:
var contactForm = {
container: $('#contact'),
show: function(){
contactForm.container.show();
},
close: function() {
$('<span class=close>X</span'>).prepandTo(this); //#contact
}
};
For some reason 'this' in the function 'close' refers to contactForm.container. How come it refers to the variable if it supposed to refer to object contactForm? O_o
Thanks!