🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: DOM and Events: all 10 questions

Quiz: DOM and Events · Question 3 of 10

Why is setting innerHTML from user input risky?

Why is setting innerHTML from user input risky?

  1. A.It's slow
  2. B.It can execute injected scripts (XSS)
  3. C.It deletes the DOM
  4. D.It only works in Chrome
Answer & explanation

Correct answer: It can execute injected scripts (XSS)

Use textContent for user text.

Can you get the rest right without peeking?

Take the timed Quiz: DOM and Events quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →