To put multiple elements by id in the same const in JavaScript, you can use the querySelectorAll method. This method returns a NodeList of all elements in the DOM that match a specified CSS selector.
You can use the # symbol to select elements by their id attribute. Here's an example:
index.tsx64 chars2 lines
This creates a NodeList containing all the elements with ids id1, id2, and id3. You can then manipulate these elements as needed using JavaScript.
gistlibby LogSnag