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 am not sure where to put the class attributes. Anywhere I put them says it is incorrect.

I am supposed to fill in the class attributes but anywhere I place them is incorrect. Any help is appreciated.

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>
      <h4>Favorite Animals?</h4>
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
    </div>

  </form>

</body>

4 Answers

oh okay thank you so very much!

Anytime, that's what we are all here for!

In each of the <div> elements you need to add the class="" attribute like this

<div class="favorite_stuff">
. . . 
</div>

I did and it still said that it was incorrect and that I needed to add the attributes.

Could you share the code that you tried?

How do I share it on here? Sorry still learning.

Just copy and paste the code you are using in the challenge in the comment box and then use the markdown to format it is html, similar to what you did for the original post.

          <p>This is code!</p>

<body>
  <h1>First Day of School</h1>

  <form>

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

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

  </form>

</body>

You have it 99.9% correct, you are just missing the equals sign:

<div class"favorite_stuff">

Should be

<div class="favorite_stuff">

Most attributes will always follow the format of attribute-name="value"

          <p>This is code!</p>
<body>
  <h1>First Day of School</h1>

  <form>

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

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

  </form>

</body>

still says it is wrong

Just noticed that you have an extra <div> tag, take (class="favorite_stuff") out of each of the divs, the ones above the h4 tags, delete them, and put class="favorite_stuff" on the containing <div>

    <div> <-- Apply the class to this one
      <div class="favorite_stuff">  <--- Delete this
      <h4>Favorite Animals?</h4>
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
      <input name="animal[]">
    </div>

Your answer should look like this when you are done:

<body>
  <h1>First Day of School</h1>

  <form>

    <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>

  </form>

</body>