Skip to content
Advertisement

how to get the list of elements matching attribute from HTMLDivElement?

This is an example source.

JavaScript

With this.mainRef, how do I get the list of elements matching attribute of ‘role=option’?

Something like..

JavaScript
  • I don’t want to go through the DOMs tree because the structure might get changed.
  • I would like to “search” instead.

THANKS!

Advertisement

Answer

Please try below.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement