Section 1 - Instruction

Great work learning to select elements! Now let's make those elements actually change what they display on the page.

Once you've selected an element, you can modify its content in two main ways: textContent and innerHTML.

Engagement Message

Can you name the two properties that let you change an element's content?

Section 2 - Instruction

The textContent property lets you change the text inside an element. It's perfect for updating plain text content safely.

Here's how it works:
element.textContent = "New text here";

This replaces whatever text was inside that element with your new text.

Engagement Message

What do you think happens to the old text?

Section 3 - Instruction

Let's say you selected a paragraph:
let myParagraph = document.getElementById("intro");

Then you can change its text:
myParagraph.textContent = "Welcome to our site!";

The paragraph will now display "Welcome to our site!" instead of whatever it showed before.

Engagement Message

In your own words, what does textContent do?

Section 4 - Instruction

The innerHTML property is more powerful—it can change both text AND HTML tags inside an element.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal