Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Kevin Murphy
Kevin Murphy
24,380 Points

Firefox innerText undefined - Teacher's Note

Heads up if you are using FF you will experience an error in this stage as innerText is not implemented by Mozilla - There is a teacher's note that provides a work-around -- Thanks @Andrew Chalkley for including that note - I would have been lost without it.

Note additionally that the example is for the edit button but the delete and the label will also require the conditional as well.

if (typeof editButton.innerText === "undefined")  {
    editButton.textContent = "Edit";
  } else {
    editButton.innerText = "Edit";

 if (typeof deleteButton.innerText === "undefined")  {
    deleteButton.textContent = "Delete";
  } else {
    deleteButton.innerText = "delete";

   if (typeof label.innerText === "undefined")  {
     label.textContent = taskString;
  } else {
    label.innerText = taskString;

If you're not worried about special character rendering or x-browser compatibility substituting innerHTML for innerText will work also.

1 Answer