how to .call() on the unnamed function in javascript?
- by Anonymous
Let's suppose I have button #click,
And suppose I bind the on click event as follows:
$('#click').click(function(){
alert('own you'+'whatever'+$(this).attr('href'));
});
But I want this to refer to some other element, let's say #ahref.
If it was a named function I would simply refer it by name:
foo.call('#ahref');
How could I use .call() though, if the function is called inline and does not have a name?