nerdexam
Microsoft

98-375 · Question #29

You need to use JavaScript to access the "section1" element in the following code fragment: <div id='section1'> Which method should you use?

The correct answer is B. getElementById. See the full explanation below for the reasoning.

Question

You need to use JavaScript to access the "section1" element in the following code fragment:

<div id='section1'> Which method should you use?

Options

  • AgetElementsByTagName
  • BgetElementById
  • CgetElementsByName
  • DgetElementsByClassName

How the community answered

(56 responses)
  • A
    9% (5)
  • B
    73% (41)
  • C
    4% (2)
  • D
    14% (8)

Community Discussion

No community discussion yet for this question.

Full 98-375 Practice