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

how do i give both <div> elements the class of "favorite_stuff"?

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

  </form>

</body>

4 Answers

Ethan Rivas
Ethan Rivas
9,979 Points

Hi David,

Just add the class attribute to the divs like this:

<div class="favorite_stuff">

That's what i keep doing but it's saying i have it wrong. What am i not doing correctly?

Ethan Rivas
Ethan Rivas
9,979 Points

David Garcia Try the answer provided by Jason Chan! It's the last answer of this thread.

You need to add a class to both of the DIVs:

 <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>
jason chan
jason chan
31,009 Points
<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

you put class into the parent div. Make sure you know the hierarchy of html elements. This will come in handy once you start doing stuff on reactjs.

This is what mine looks like: <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>

........AND IT STILL GIVING ME THE "BUMMER"!! HELP!

never mind, i figured it out!!!!!