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 Selecting Elements and Adding Events with JavaScript Plan

Andreas Kratzel
Andreas Kratzel
2,858 Points

This would be so easier to follow if the HTML was well-structured

I think this step would have been SO much easier to follow along when the HTML was more structured.

I found it hard to follow along with every element next to each other instead of below or something like that. Of course you can do it yourself, but I think it would have been better to start off with a well-structured HTML sheet right away.

Jeremy Castanza
Jeremy Castanza
12,080 Points

I agree - at least from a readability standpoint. I added my own if anyone wants to borrow it. You may have to make a minor change to the button width in the CSS file due to the line breaks.

    <div class="container">
      <p>
        <label for="new-task">Add Item</label>
          <input id="new-task" type="text">
          <button>Add</button>
      </p>

      <h3>Todo</h3>
      <ul id="incomplete-tasks">
        <li>
          <input type="checkbox"><label>Pay Bills</label>
            <input type="text">
            <button class="edit">Edit</button>
            <button class="delete">Delete</button>
        </li>
        <li class="editMode">
          <input type="checkbox"><label>Go Shopping</label>
            <input type="text" value="Go Shopping">
            <button class="edit">Edit</button>
            <button class="delete">Delete</button>
        </li>  
      </ul>

      <h3>Completed</h3>
      <ul id="completed-tasks">
        <li>
          <input type="checkbox" checked><label>See the Doctor</label>
            <input type="text">
            <button class="edit">Edit</button>
            <button class="delete">Delete</button>
        </li>
      </ul>
    </div>

1 Answer

I think this is what prepares us for the stuff we're going to face outside the treehouse universe. Of course it's always helpful to have a well structured HTML but we ain't gonna be that lucky all the time. So this practice of reading and understanding a complex structure/code may come handy some time.