Set textContent or innerHTML to change element content.
const el = document.querySelector("#message");
el.textContent = "Updated text";
el.innerHTML = "<strong>Bold text</strong>";
Setting innerHTML parses the string as HTML. Be careful with user input to avoid XSS attacks.