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

Sarah Pellecchia
PLUS
Sarah Pellecchia
Courses Plus Student 2,335 Points

I cant figure out what is wrong here. please help!

Ive looked at it a dozen times. not sure what im missing.

index.html
<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>
Ryan Fox
Ryan Fox
4,971 Points

In the initial challenge, they have divs that wrap the input tags. You shouldn't need to write in your own to pass the challenge. You're correct writing them here, but the challenge wants them on the given div blocks :)

Hope this helps!

3 Answers

Well I see you passed task 1 which was to add a class attribute to the divs. Task 2 is the same idea, only now you add the name attribute, with the value text, to all the input tags. So you add: type="text" to the input fields.

EDIT: I see now that you have the div opening tag twice, you needn't create another div within the div, just add the class property to the first div, so it should be:

<div class="favorite_stuff">

      <h4>Favorite Foods?</h4>
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
      <input name="food[]">
    </div>
Bogdan Cabaj
Bogdan Cabaj
16,348 Points

Hi Sarah,

Below html worked for me. Your class entries are correct. For challenge 2 we need type="text" for each input tag.

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

<form>

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

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

</form>

</body> '''

Sarah Pellecchia
PLUS
Sarah Pellecchia
Courses Plus Student 2,335 Points

thanks everyone. The hint they gave me confused me instead of helping me! :)