gpt4 book ai didi

javascript - 减少用于加速交互的 jquery 选择器的数量

转载 作者:行者123 更新时间:2023-11-29 22:31:17 25 4
gpt4 key购买 nike

我有一个包含多个选择器的页面。每个都有一个点击事件。我只是想知道有没有办法组合这些选择器,甚至做一个全局选择器并让 jQuery 找到被点击的内容?

最佳答案

"Do a global selector and have jQuery find what was clicked?"


$('select').click ( function () {
console.log ('A ', this.nodeName, ' was clicked\n',
'It had an id of: ', this.id
);
/* Etc., etc. You can use jQuery or standard DOM to
tell most anything about the element that was clicked.
*/
} );

关于javascript - 减少用于加速交互的 jquery 选择器的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6841446/

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