-4

hey would love to have a take from a more experienced coder about this.

Would appreciate if you could give it to me in the below code format, thanks a lot

3

2 Answers 2

0

You could use document.querySelectorAll.

This returns a Node List, to convert that to an Array, you could do

const elements = [...document.querySelectorAll(".my-selector")];
Sign up to request clarification or add additional context in comments.

Comments

0

That's called Vanilla Javascript

An example

var myArray = document.getElementsByClassName('myClass')

myArray will be a HTMLCollection

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.