JQuery, is there a way to select all elements on the page with a specific attribute?

后端 未结 1 787
天涯浪人
天涯浪人 2020-12-03 20:14

Assuming I create something like:

Text

..

I then want to find on my page,

相关标签:
1条回答
  • 2020-12-03 20:45

    You can use the has-attribute selector, for example:

    $("[myAttribute]")
    

    To get elements with that attribute with that specific value, use the attribute-equals selector, like this:

    $("[myAttribute='Hello']")
    

    You can find the full list of Attribute Selectors available here.

    0 讨论(0)
提交回复
热议问题