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 trialBetsy Gibson
Courses Plus Student 1,521 PointsI 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.
<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
Betsy Gibson
Courses Plus Student 1,521 Pointsoh okay thank you so very much!
Luke Pettway
16,593 PointsIn each of the <div> elements you need to add the class="" attribute like this
<div class="favorite_stuff">
. . .
</div>
Betsy Gibson
Courses Plus Student 1,521 PointsI did and it still said that it was incorrect and that I needed to add the attributes.
Luke Pettway
16,593 PointsCould you share the code that you tried?
Betsy Gibson
Courses Plus Student 1,521 PointsHow do I share it on here? Sorry still learning.
Luke Pettway
16,593 PointsJust 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.
Betsy Gibson
Courses Plus Student 1,521 Points <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>
Luke Pettway
16,593 PointsYou 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"
Betsy Gibson
Courses Plus Student 1,521 Points <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>
Betsy Gibson
Courses Plus Student 1,521 Pointsstill says it is wrong
Luke Pettway
16,593 PointsJust 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>
Luke Pettway
16,593 PointsLuke Pettway
16,593 PointsAnytime, that's what we are all here for!