You are working on a form validation feature where you want to select all input elements within a form. Which method allows you to select all input elements within a specific form element?

  • querySelectorAll('input')
  • getElementById('form')
  • getElementsByTag('form')
  • querySelectorAll('form input')
To select all input elements within a specific form, you should use the querySelectorAll('form input') method. This allows you to target input elements that are descendants of a specific form element. The other options are incorrect because they either select all input elements on the page or attempt to select a form element by ID or tag name, which doesn't filter the input elements within it.
Add your answer
Loading...

Leave a comment

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