The question is the following: in my HTML document I have multiple labels P
with the class price, example <p class="precio">
400 </p>
. And I want to build an array that contains the values of all those paragraphs.
The intention of creating this arrangement is to be able to filter them with javascript using filter() and make the paragraphs disappear or appear if they meet x condition
The first thing would be to use
document.querySelectorAll
which you can select a class and it will return an array.Then you go through that array and save the content of each of the elements in another array