Getting element by a custom attribute using JavaScript

前端 未结 7 1057
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 05:24

I have an XHTML page where each HTML element has a unique custom attribute, like this:

<
相关标签:
7条回答
  • 2020-11-30 06:14

    Doing this with vanilla JavaScript will do the trick:

      const something = document.querySelectorAll('[data-something]')
    
    0 讨论(0)
提交回复
热议问题