0

I am trying to store muliple html elements in one variable in javascript. I am trying like this.

const htmlElements = document.querySelector(['.A', '.B', '.C']);

is there a way that htmlElements can return the array of these elements from HTML but this syntex is giving me error. Can anyone help me with this?

  • sure the arguments are an array not simple parameters separated by commas?https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector. BTW, in Angular generally use template reference variable and ViewChildren:https://angular.io/api/core/ViewChildren – Eliseo Jun 08 '21 at 09:16

0 Answers0