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

HTML

Error saying "button must be placed between form tags"

What is the error here?

<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>

<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> 

Jennifer to the rescue :D

7 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there Dare Adelugba! The problem isn't actually with the button, it's with the textarea element. This particular element requires a closing tag. This is specified by the MDN documentation.

So change this line with the textarea to this:

<textarea id="comment" name="user_comment"></textarea>

Hope this helps! :sparkles:

Was this a challenge question? If so link to that challenge or copy and paste the exact question. That could help trouble shoot it.

I don't see any difference in mine and yours, but this passed for me

    <form action="index.html" method="post">
      <input type="text" id="name" name="user_name">
      <textarea id="comment" name="user_comment"></textarea>
      <button type="submit">Submit Comment</button>
    </form>

This beats me. I've stuck on this for hours because it kept rejecting my answers. I am not happy that it will add to my total challenges even though this is a a bug error.

Thank you Jennifer it helps, instantly. This is unreal that I couldn't notice this for hours.

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

You're quite welcome! And don't worry, it happens to all of us. We sit there and look at it and look at it and someone else says "Oh you're missing a comma here". It's always nice with a second pair of eyes. That being said, the reason it was giving the button error is because it couldn't add the button to the form without you first closing the textarea. And while it may seem misleading, it was accurate.

You're the best! Thanks for taking the time for this. I am enjoying these tutorials.