在 jQuery 中,如果元素包含属性,无论其值如何,我如何找到它们?

In jQuery how do I find elements if they contain the attribute, regardless of its value?

在 jQuery 中,我可以像这样查找具有特定数据属性值的元素 ...

$(myElt).find(`[data-slide='${current}']`)

但是我如何根据它是否包含 "data-slide" 属性来查找元素,而不管 "data-slide" 值设置为什么?

你可以只写:

$(myElt).find(`[data-slide]`);