我有一个包含多个选择器的页面。每个都有一个点击事件。我只是想知道有没有办法组合这些选择器,甚至做一个全局选择器并让 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/