gpt4 book ai didi

jquery - 将 $(this) 传递给函数

转载 作者:行者123 更新时间:2023-12-01 07:02:10 25 4
gpt4 key购买 nike

在 JQuery 中,我们如何将整个 $(this) 传递给函数?可能吗?

最佳答案

嗯,这取决于您要传递的内容,但是您是否刚刚尝试过以下操作:

function do_something_cool(jquery_link_object) {
/* I do something awesome! */
}

$('a.my_link_class').click(function() {
do_something_cool($(this));
});

这会将单击的链接传递给 do_something_cool 方法。

关于jquery - 将 $(this) 传递给函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2433297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com