To exclude elements with the class "kk-utility-details", you can modify the selector to "[role='article']:not(.kk-utility-details)". This will select the closest ancestor element with the attribute "role" set to "article", excluding any elements with the class "kk-utility-details.

Exclude Elements with Specific Class Using closest() Selector in JavaScript

原文地址: https://www.cveoy.top/t/topic/qhEK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录