DOM Manipulation

textContent

textContent

textContent is the plain text inside an element. Reading it gives you the current text. Assigning to it changes what the user sees on the page.

This is one of the first DOM mutations you should trust because it treats text as text. It does not ask the browser to parse markup.

Your task: Select the status message and change its textContent so the page shows that the profile is saved. Store the element in statusMessage before changing it.

Prerequisites

  • dom/selecting-elements

Tests

  • updates the status message text
  • stores the selected element
  • does not create a duplicate status message
Loading...
Console

Run code to see output.