Rol*_*oll 9 jquery jquery-selectors
以下代码将为具有Class = a.cssPauseAll
OR
attribute =的元素的click事件触发警报historyID
$(document).on("click","a.cssPauseAll,[historyID]", function () {
alert($(this));
});
Run Code Online (Sandbox Code Playgroud)
如何使用AND
运算符使用多个选择器?
这意味着具有a.cssPauseAll
class AND
historyID
属性的元素?
只需,
从选择器中删除:
$(document).on("click","a.cssPauseAll[historyID]", function () {
Run Code Online (Sandbox Code Playgroud)
historyID
不是您可以使用data-*
属性的有效属性:
$(document).on("click","a.cssPauseAll[data-historyid]", function () {
Run Code Online (Sandbox Code Playgroud)