gpt4 book ai didi

javascript - 触发点击并链接点击行为

转载 作者:行者123 更新时间:2023-12-03 11:36:18 25 4
gpt4 key购买 nike

我需要模拟匹配元素(链接)的自动点击,但我也想在同一行添加点击行为逻辑,这可能吗?类似于下面的 alert("my Click Behaviour");

而不是以下内容:

jQ('tbody[groupstring^=";#Emergency;#"] a').click(function(){
jQ(this).parent().parent().parent().next().find('td:contains("Emergency")').each(function(){
jQ(this).html(jQ(this).html().replace(/Emergency/g,"Urgent"));
});
})

我想将上面的点击行为直接链接到下面:

jQ('tbody[groupstring^=";#Emergency;#"] a').each(function(){
jQ(this).trigger('click').My Click Behavior();
})

最佳答案

这就是定义点击行为的方式

jQ('tbody[groupstring^=";#Emergency;#"] a').each(function(){
jQ(this).click(function() {
//what should happen on click
});
})

您可以通过以下方式为许多元素定义相同的点击行为:

jQ('tbody[groupstring^=";#Emergency;#"] a').click(function() {
//what should happen on click
});

这是触发点击的方式:

$(mySelector).click();

关于javascript - 触发点击并链接点击行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26496820/

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