Reputation: 548
function myfunc() {
alert($(this));
}
$("#SELECTOR").delegate("SELECTOR","click",myfunc);
This is about clicking on different images, therefore, I'd really love to use the $(this) variable in my user function.
Is that possible? Is there any workaround?
Upvotes: 1
Views: 76
Reputation: 3243
Yes. The syntax for delegate is:
$('#container').delegate('selector','event',function(){
//code to respond to event
});//end delegate
which is pretty much what you already have,..
A working example which includes the method you are attempting is here - http://jsfiddle.net/E9dgU/5/
Upvotes: 1