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

Siagigi Sanggaran
PLUS
Siagigi Sanggaran
Courses Plus Student 1,699 Points

need help, applying CSS style <div> class on an index.html

it is asking to apply the CSS style on both< div> element of "favourite_stuff". I have watched the video a few times, attempts to position the example given inside the document, in various location in the index.html. It does not appear to work. it took me two days to try and solve the code! I have seen the form layout, examples, it does not have the same as the one i am looking at on the screen. Anyone able to have a solution yet! please to this code. Thanks

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

  <form>

    <div>
      <div class="favourite_stuff">
      <h4> Favourite Food?</h4>
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
    </div>




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

  </form>

</body>
Chris L
Chris L
8,619 Points

You're adding an extra <div> inside the <div> the challenge is asking you to edit. Just add the class to both of the <div> elements that already exist:

Example:

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

2 Answers

There are two opening div tags in your code, that's the problem.

<div>
  <div class = "favourite_stuff">
/// code
</div>

Put the class in first div and remove the second div.

<div class = " favourite_stuff">
/// code
</div>
Siagigi Sanggaran
Siagigi Sanggaran
Courses Plus Student 1,699 Points

Hi Samuel, I tried, deleting the extra opening div tag from the code. And added <div class =" favourite_stuff"> on div( 1) food and (2) animal, but it still comes up with this respond: The class attribute on both of your <div> elements needs to be set to "favorite_stuff". (1) <div class="favourite_stuff"> <h4> Favourite Food?</h4> <input name="food[]"> <input name="food[]"> <input name="food[]"> <input name="food[]"> </div>

(2) <div class="favourite_stuff"> <h4>Favorite Animals?</h4> <input name="animal[]"> <input name="animal[]"> <input name="animal[]"> <input name="animal[]"> </div> Any suggestions on this? on where i could of gone wrong with the code?

Hey, Siagigi Sanggaran . It's just a typo. The class name is favorite_stuff, not favourite_stuff. My bad. Haha.