How do I get all elements that have a specific label?

In my page, I have several elements with different ids and tags. However related elements have a similar label. What I want is to get all the elements with a label “cls” into an array. How can I achieve this?

Nope. I already got it for label and aria-label. Thanks for help though!

I used

var list = document.querySelectorAll('[label="cls"]');
1 Like