Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试选择具有数据链路属性的父级
var url = $(e.target).parents(['data-link']).addClass('selected');
这可能吗?
是的
.parents('[data-link]') //<-- string denoting attribute
不是
.parents(['data-link']) //<-- array containing string