jQuery - How to match an element has attribute a or attribute b

后端 未结 3 459
無奈伤痛
無奈伤痛 2021-01-20 23:58

How to write a jquery selector to match an element has attribute a or attribute b. It must match three elements below


<         


        
3条回答
  •  孤独总比滥情好
    2021-01-21 00:42

    You can use a multiple selector (,) with the attribute-equals selector (or any other selectors), for example:

    $("a[a=123], a[b=345]")
    

    You can test it out here.

提交回复
热议问题