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

Set that text input to contain "Hello world"

i have tried this many times not able to fine the solution i have enterd <input type="text" name="message" value="Hello world"> and i have also tried <input type="text" name="message" value="Hello world">Hello world<br>

But i got the same error try setting the 'value' attribute on the text input

can anyone help me out please i am struck here

3 Answers

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey,

could you please post your code so I can see where the mistake might be? :)

To set the value of an input to a text you have to set the value attribute of the input to this text. Also take care that you write the W in "World" in uppercase.

Like so:

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

I hope that helps you to solve the challenge, good luck! :)

<html> <head> <title>HTML Mastery Challenge</title> </head> <body> <h1>HTML Mastery Challenge</h1>

<div> <h2>Shopping List</h2> <ol> <li>Fruits</li> <li>Clothes</li> <li>Shoes</li> </ol> <p><strong>Text is in Bold</strong></p> <form> <input type="text" name="Mark"> <input type="text" name="Message" value="Hello World">
</form> </body> </html>

hey i have tried this but i am getting the same error can u please help me out ""Try setting the 'value' attribute on the text input""

This is the error i got

Thank you for your quick response

Tobias Helmrich
Tobias Helmrich
31,602 Points

Hey, actually it should work if you use the code I posted above for the input tag. Could you please post the whole code? :)

i have posted the whole code cant u scroll it down

<html> <head> <title>HTML Mastery Challenge</title> </head> <body> <h1>HTML Mastery Challenge</h1> <div> <h2>Shopping List</h2> <ol> <li>Fruits</li> <li>Clothes</li> <li>Shoes</li> </ol> <p><strong>Text is in Bold</strong></p> <form> <input type="text" name="Mark"> <input type="text" name="Message" value="Hello World">
</form> </body> </html>

i have posted the whole code again have you got it

Tobias Helmrich
Tobias Helmrich
31,602 Points

Yes, I've got it. I'm sorry, I thought that wasn't the whole code. However take care that you format your code correctly because your code stops after the ordered list. :) About which task are you talking about in particular?

Tobias Helmrich
Tobias Helmrich
31,602 Points

Ah, now it's properly formatted, alright! Have you tried removing the first input element? I think the challenge only wants you to have one input element.

Try removing this:

<input type="text" name="Mark">

so you just have this input element

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

in your code.

ya got it thanks alot for your help

Tobias Helmrich
Tobias Helmrich
31,602 Points

No problem, always happy to help!