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 trialJan Lundeen
5,886 PointsGet the error "Bummer! Your <div> elements need to both have 'class' attributes." What am I missing?
Hi,
When I added classes to both div sections on Challenge Task 1 of 2(First Day of School), I got the error "Bummer! Your <div> elements need to both have 'class' attributes."
I added classes to both sections (see code below). What am I missing?
<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[]">
Thanks,
Jan
<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>
2 Answers
Jan Lundeen
5,886 PointsYou're right. The open/close tags are unbalanced. I was thinking that the original <div > tag should be left alone, but it looks like that's not the case. I just need to add class = "favorite stuff" to the original tag. Thanks!
Jan
Steven Parker
231,269 PointsIt looks like you added a duplicate opening tag for the div
elements.
Instead of adding the class to the existing div
tags, you seem to have added a completely new opening div
tag. So now the open/close tag pairs are unbalanced, plus the original div
tags still do not have classes.