in all jquery examples i see this kind of code:
$('.menu a').each(function(){
$(this).animate({paddingLeft: $(this).width()}, 200);
});
What they do here is create a function ‘on the fly’ (is that called an anonymous delegate?)
but what if i have an existing function, which wants to have access to the $(this) also?
let’s say i have this function:
function doAnimate(ctl){
//do something here
{
How can i use that function in the jquery statement?
Reason i ask is that i want to use this function in more jquery statements, and i don’t want to type the anonymous delegate multiple times.
I’ve tried this, but that gives me an error:
$("#<%=txtReceiverEmailEcard1.ClientID %>").blur(blurWatermark($(this), 'Your email address'));
This is from the jQuery API documentation
And the signature of the method is
You can then write
That basically means that you can get all kind of nice information (like index) to your callback.