• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XenForo.context vs function .bind


Active member
What is the difference the $.context (extended from jQuery via XenForo) function works like the function bind?

for example...

$('#element').click($.context(this, 'elementClick'));

I can see that it would work best this above if your trying to reference a function.



$('#element').click(this.elementClick.bind(this)); which is the same thing as $.context(this, 'elementClick');

alert('Hello World');
}, this));

What is the purpose of the two functions?