Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perform: Modifying Elements

Aaron Munoz
Aaron Munoz
11,177 Points

Why can't you use the innerText method in dot notation?

I tried reading up on it on the MDN but no luck. Anyone know why you have use it like this instead?

element.innerText = "string";

instead of

element.innerText("string");

By the way, I HATE the MDN documentation. It's worthless if you're trying to find things.

1 Answer

Colin Marshall
Colin Marshall
32,861 Points

Technically it is still dot notation, hence the dot after the element you are calling it on. The difference is that InnerText is a property of a block-level element, not a method.

Aaron Munoz
Aaron Munoz
11,177 Points

Awesome. That makes complete sense now.