gpt4 book ai didi

javascript - 在 JavaScript 中传递 $this

转载 作者:行者123 更新时间:2023-11-30 07:01:23 25 4
gpt4 key购买 nike

我将如何重写它以使用一个通用函数,假装该通用函数最终会包含不止 1 行代码:

$('.insert').hover(function() {
$(this).css('cursor','pointer');
});
$('.delete').hover(function() {
$(this).css('cursor','pointer');
});

最佳答案

或者如果你只是想避免重复代码

$('.insert,.delete').hover(function() {
$(this).css('cursor','pointer');
});

关于javascript - 在 JavaScript 中传递 $this,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5278841/

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