How do I get all the occasions of <div data-test=“value”> on a page?
So:
<body>
<div class="section" data-test="123">
<div class="top">
</div>
<div class="bottom" data-test="123">
</div>
</div>
<div class="section">
<p data-test="123">
</p>
</div>
</body>
…returns reference to the three occasions above and allows me to perform actions on the node they sit on.
I know $(“.section”).data(“test”) will get it but I want to get it for all occasions on any page with any HTML and any classes.
I tried $(‘body’).data(‘test’) and $(‘div’).data(‘test’) but nothing.
Thanks.