How can you select all

elements within a specific parent element?

  • document.getElementsByTagName('p')
  • document.select('p')
  • document.querySelectorAll('p')
  • parentElement.querySelectorAll('p')
To select all

elements within a specific parent element, you can use the querySelectorAll() method on the parent element. This method allows you to specify the CSS selector within the context of the parent element, ensuring that only

elements within that parent are selected. The other options are incorrect for this purpose.

Add your answer
Loading...

Leave a comment

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