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
stevencooper
5,755 PointsWhat am I doing wrong with the "button" element?
I am having trouble with a challenge. I'm supposed to: After the textarea, create a button element. Between the button tags, write the text "Submit Comment". Don't add any attributes yet.
here is the html code I have. It looks identical to the example shown in Nick's video.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Forms</title>
</head>
<body>
<form action="index.html" method="post">
<input type="text" id="name" name="user_name">
<textarea id="comment" name="user_comment">
<button type="submit">Submit Comment</button>
</form>
</body>
</html>
I keep getting the response: "Bummer! You need to add a <button> element inside the <form> element.".
I've tried leaving out the "type="submit"" part of the declaration, but that isn't the problem.
Can anyone suggest an answer to this?
4 Answers
Salman Akram
Courses Plus Student 40,065 PointsEDIT: Thank you for letting me know, so I delete the comment and move here, I hope it will solve. :)
I think, they are looking for just button without adding type. Try this below if that works.
<form action="index.html" method="post">
<input type="text" id="name" name="user_name">
<textarea id="comment" name="user_comment"></textarea>
<button>Submit Comment</button>
</form>
Don't forget to add end tag </textarea> before button tag.
Garrett Sanderson
12,735 PointsHi Steven Copper,
It is telling you not to add any attributes to the button element. So it should look like this:
<body>
<form action="index.html" method="post">
<input type="text" id="name" name="user_name">
<textarea id="comment" name="user_comment"></textarea>
<button>Submit Comment</button>
</form>
</body>
Wayne Priestley
19,579 PointsHi Steven,
Salman has given you the answer but forgot to point it out, close your textarea thats why your getting element within a element Bummer
stevencooper
5,755 PointsI'd love to give Salman credit with the Best Answer, but he apparently put his response in the Comment section, not the Answer section.
I think if he goes back and responds as an answer rather than a comment, then I can give him the best answer check-mark.
thanks to everyone, the fix worked...I was actually 2 questions ahead of myself.
David Low
8,214 Pointsthanks guys, i was struggling with this one myself :)