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 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,081 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.