To avoid cross-site scripting (XSS) attacks, instead of innerHTML, use _________.

  • textContent
  • appendChild
  • createElement
  • setAttribute
To prevent XSS attacks, it's recommended to use the textContent property. Unlike innerHTML, which can execute scripts, textContent only sets the text content of an element, making it safer for user-generated input.
Add your answer
Loading...

Leave a comment

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