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

Set that text input to contain "Hello World"

I guess I'm not sure how to add the text of "Hello World" into my text input. I tried using the placeholder attribute (correct term?)

Even after going back to the videos I didn't find Nick ever putting in text via the html file.

  <!-- Write your code below -->
  <div>
     <h2>Shopping List</h2>
      <ol>
         <li></li>
         <li></li>
         <li></li>
      </ol>
  </div>
  <p><strong>Hello World</strong></p>
  <form>
    <fieldset>
      <legend>Hello World</legend>
        <input type="text" name="Hello World" placeholder="Hello World">
    </fieldset>
  </form>

I spent forever on this one.. because I read 'Hello World!' not 'Hello World'

That's funny...so did I! I think they should change it... "!" is the standard.

Jill Marcum -

Traditionally it's always been Hello, world!

source: https://en.wikipedia.org/wiki/List_of_Hello_world_program_examples

You need to change the placeholder attribute to the value attribute. Whatever the value of the value attribute is will be displayed in the text input element.

19 Answers

The value attribute for an input field is the text that's displayed whereas the placeholder attribute is an HTML5 feature, that shows text in an input box only until the user starts typing.

 <input type="text" name="Hello World" value="Hello World"> 

This right?

Yes, that is right, thanks!

@James, I am completing the HTML mastery tasks as well and the videos do not explain the value attribute in this context.

When I put it in that way it says I failed the code challenge.

The code challenge is to: Set that text input to contain "Hello World"

So they are asking me to have the text "Hello World" be populated in my text field is what I gather. Though they did not cover that in the video, and placeholder is the only way I knew how to do it otherwise. So I'm not really sure what it is they want me to do or how to do it.

Solved: It was the "value" attribute that they were looking for.

Value wasn't covered at all in the training...

Actually it was covered, just not in the form of a text field. It wasn't well explained but on the lesson for creating a "submit" button nick used the value attribute to make the submit button say "continue". But i agree it wasn't obvious that you could use the same attribute to populate a text input the same way.

I was stuck in here????But I have solved the problem. <form action="#" method="POST" name="my_form"> <input type="text" name="username" value="Hello World"> </form>

<form action="#" method="POST" name="my_form"> <input type="text" name="username" value="Hello World"> </form>

I can't see to get this right. Could someone please help me? Thanks!

Cristiane Marques - Post what code you've got so.

<input type="text" name="Hello World" value="Hello World">

I always do it that way. Try it out and let me know.

Can you send me a link to the challenge, I'll take a look myself.

Yeah, I can't seem to write html here. I've already written that but it doesn't show up :/

I'm unable to get past this 'value' issue. I have: <input type="text" name="Hello World" value="Hell World">

and I'm not passing the code challenge.

Ideas? BTW, the code I post doesn't show in the post. How do you do that?

Joseph Finkenbinder -

the code I post doesn't show in the post. How do you do that?

Check out this post on how to type code in the forum

''' thanks '''

Make sure your hello wold is "Hello World" the submission is case sensitive.

<form action="#" method="POST" name="my_form"> <input type="text" name="username" value="Hello World"> </form>

James Barnett - Thanks for your help!!!

I got it right, but on the previous exercise where it asked to write an input type "text", I went ahead and completed with name and username. So, as a result when entering the right code for the last exercise (text/value) it kept catching on the (name and username) on the above line and overriding the actual line. I sent a message to the Support Team asking if they could implement the challenge section with some sort of (highlighted hint) that could show us where exactly is the error.

Thanks again for your help!

Maybe you can change placeholder="Hello World" to value="Hello World"

it should be just <input type="text" value="Hello World"> just removed the name="Hello world" on your code