[英]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. 我对如何使用click事件来调用类中的另一个函数感到困惑。
$.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.
我不想这样做,所以当您单击图像时它将调用该函数。
jQuery's kinda funny about passing an HTML element when you'd expect a jQuery one. jQuery有点有趣,可以在需要jQuery元素时传递HTML元素。 try using
$(this)
instead of this
. 尝试使用
$(this)
代替this
。
Also, jQuery functions like to take functions as params, but i'm not sure exactly what this code is trying to do now. 另外,jQuery函数喜欢将函数作为参数,但是我不确定这段代码现在到底想做什么。 The first "(image)" should probably be "= function(image)" instead.
第一个“(图像)”可能应该改为“ = function(图像)”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.