often in some jQuery code I see that this
is assigned to the variable in jQuery and I do not understand the reason for this approach?
This is an example of a jQuery plugin constructor:
//constructor
function Nullpoll(element, options){
var widget = this;
widget.config = $.extend({}, defaults, options);
widget.element = element;
widget.element.on( "click", function() {
alert("Test")
});
widget.element.one("change", function(e){
widget.element.find("button").removeProp("disabled");
});
this.init();
}