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 HTML Forms Form Basics Create a Submit Button

this should work. I have button type

I have the button type selected. something is making treehouse stick.

index.html
<!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"</textarea> 
      <button type="submit comment" </button>
  </body>
</html>

2 Answers

Thomas Mejer
Thomas Mejer
8,761 Points

You have to remember to both construct and close your HTML-tags correctly. In many text editors, and in the example above you'll get visual clues if your tags are not formatted correctly. See the red "</" in your code.

Remember that most HTML-tags have both an opening and a closing tag. Eg. <body></body>.

Also take a look at MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

Tim Knight
Tim Knight
28,888 Points

Hi Kim!

There are a few things I want to point out here.

First, you want to make sure that you're complete when constructing an opening and closing tag. This goes for both your textarea and your button. Currently, you have both of those opening tags unclosed with a >.

<textarea id="comment" name="user_comment"</textarea> 
<button type="submit comment" </button>

Should become:

<textarea id="comment" name="user_comment"></textarea> 
<button type="submit comment"></button>

Next, you have an erroneous value in your button's type attribute which you currently have as submit comment. The value here should really just be submit by itself. This tells the button that it should submit the <form> that it would be within.

<textarea id="comment" name="user_comment"></textarea> 
<button type="submit"></button>

You'll want to add a value for your button, something that gives the user an idea of what the button does, like "Post Comment".

<textarea id="comment" name="user_comment"></textarea> 
<button type="submit">Submit Comment</button>

In the case of this challenge however they asked you not to include any attributes for button so you'd actually use:

<button>Submit Comment</button>

Then finally, make sure you close out your form tag. All of your form elements should be within a form open and closing tag so the submit button knows what to do.

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

I hope that helps!