R
ragtek
Guest
I have this code:
I thought that the click function is only loaded, when i click on $link, but it's called on the pageload.
Where's the problem?
Code:
!function($, window, document, _undefined)
{
Ragtek.Sidebar = function($element){
this.__construct($element);
};
Ragtek.Sidebar.prototype =
{
__construct: function($link){
this.$link = $link;
console.log('init sidebar');
console.log($link);
$link.click($.context(this, 'click'));
},
click: function(e){
console.log('event called');
}
}
XenForo.register('#switchButton', 'Ragtek.Sidebar');
}
(jQuery, this, document);
Where's the problem?
