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 Treehouse Club - MASH MASH - HTML Forms, Divs, and Inputs

I'm lost, I already saw the video 4 times, but I don't know what I missed, how do I add the class here?

I've tryied using the workspace from the last video and tried matching the class tags with the stuff that's pre-made and nothing seems to work, is there something that I'm missing?

index.html
<body>
  <h1>First Day of School</h1>

  <form>

    <div>
      <h4>Favorite Foods?</h4>
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
    </div>
    <div class= "favorite_stuff">
      <h4> Favorite stuff?</h4>
      <div class= "favorite stuff" type= "text">
      <div class= "favorite stuff" type= "text">
      <div class= "favorite stuff" type= "text">
      <div class= "favorite stuff" type= "text">
    </div>
    <div>
      <h4>Favorite Animals?</h4>
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
    </div>

  </form>

</body>

2 Answers

Steven Parker
Steven Parker
229,744 Points

:point_right: It looks like you may have changed the wrong things.

Task 1 of the challenge says: Give both <div> elements the class of "favorite_stuff". But you did not add a class to either of the original div's. I see where you added an entirely new div (with several inner div's) in between the original ones. Now your added div does have the class correctly added, but I'm sure the challenge is not expecting to see a lot of additional new elements.

Try restarting the challenge and adding the class to each of the original div elements. Be sure to not add any other code that might confuse the challenge checker. I'll bet you can pass it this time.

And when you get to task 2, be sure to handle it in a similar way and don't add any new elements. Just add the properties to the elements already there.


To recap, if the original code looks like this:

    <div>

After adding the class it will look like this:

    <div class="favorite_stuff">

You don't need to add the new <div> Favorite Stuff at all. You simply need to add class="favorite_stuff" to the two original <div> elements: Favorite Foods? and Favorite Animals?.

See below:

    <div class ="favorite_stuff">
      <h4>Favorite Foods?</h4>
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
    </div>

    <div class ="favorite_stuff">
      <h4>Favorite Animals?</h4>
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
    </div>

so what you're saying is that to add a "class" I don't need the "<>" or the "div" in between?