anthonypliu
anthonypliu

Reputation: 12437

How do you use the click event properly to call another function within the class?

I was confused on how to use the click event in order to call another function within the class.

$.fn.imageareaselect(image)
{ 
this.click(function(){
$.fn.pinpointImage.add(image);
});
}

The selector that is passed into this function is an image. I wan't to make it so when you click the image it calls that function.

Upvotes: 0

Views: 65

Answers (1)

cHao
cHao

Reputation: 86525

jQuery's kinda funny about passing an HTML element when you'd expect a jQuery one. try using $(this) instead of this.

Also, jQuery functions like to take functions as params, but i'm not sure exactly what this code is trying to do now. The first "(image)" should probably be "= function(image)" instead.

Upvotes: 2

Related Questions