gpt4 book ai didi

javascript - 如何制作 $(this) 的 this?

转载 作者:行者123 更新时间:2023-11-30 11:43:35 27 4
gpt4 key购买 nike

<分区>

这是我的代码:

$(.clsname).on("click", function(){
do_something($(this));
});

function do_something(sth){
/*
* in here sth equals $(this)
* and I want to get "this" of "$(this)"
*
* EX: this.value = "some value";
* I know I can do that like sth.val("some value");
* but I need to do that by following the first version (using "this")
*/
}

如您所见,我的问题在上面的代码中有注释。我该怎么做?

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