To select elements with a specific class name, you should use the __________ method.

  • getElementById()
  • getElementByClass()
  • querySelectorAll()
  • querySelector()
To select elements with a specific class name, you should use the querySelector() method. This method allows you to select elements using CSS-like selectors, including class names. For example, document.querySelector('.classname') selects all elements with the specified class name.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *