← 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?
- A.It's slow
- B.It can execute injected scripts (XSS)
- C.It deletes the DOM
- 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 →