更新时间:2023-01-17 18:53:49
您可以使用jQuery属性包含选择器轻松实现此目标:
You can easily achieve this with jQuery attribute contains selector that:
选择具有指定属性并带有值的元素 包含给定的子字符串.
Selects elements that have the specified attribute with a value containing a given substring.
https://api.jquery.com/attribute-contains-selector/
这是最匹配的jQuery属性选择器 反对一个价值.如果选择器的字符串将选择一个元素 出现在元素属性值内的任何地方.
This is the most generous of the jQuery attribute selectors that match against a value. It will select an element if the selector's string appears anywhere within the element's attribute value.
示例:
$( "div.row[data-party-registration-source-type-id*='3']" )