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 trialTori Coker
5,735 PointsIn the text editor, i have added <div class="favorite_stuff">. error says your <div> elements are not class
I do not understand what i have written wrong. I have put the div class into the code under the first <div> element. What should i change?
<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>
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI think you have a misconception that there is something called a "div class". "div" is a type of HTML element, short for division. Any element can be given a class, as a way of targeting those elements with CSS.
So with regards to this specific challenge, they don't want you to add a div, they want you to add a class to an existing div. You have extra divs in here right now, that's why it's getting confused.
Try this:
<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>
Amandeep Dindral
8,915 PointsAmandeep Dindral
8,915 PointsHi,
Try taking out the underscore. So instead of favorite_stuff try favoriteStuff or something along those lines.
Let me know if this works.
Cheers