How to write a jquery selector to match an element has attribute a or attribute b. It must match three elements below
<a a="123" b="345"></a>
<a a="123"></a>
<a b="345"></a>
You can use a multiple selector (,) with the attribute-equals selector (or any other selectors), for example:
$("a[a=123], a[b=345]")
Or generally for mere presence of attribute
$("a[a], a[b]")
来源:https://stackoverflow.com/questions/3890265/jquery-how-to-match-an-element-has-attribute-a-or-attribute-b