How do I make a HTML input box default text remove AFTER starting to type

Jordan Clifton picture Jordan Clifton · Sep 14, 2012 · Viewed 38.8k times · Source

Say I have an input box with default text "name" in it. I would like for the user to click the box, the text stays in the box until the user starts to type.

I am not looking for code to clear the input box after focusing it.

Thanks!

Answer

alexndm picture alexndm · Sep 14, 2012

It's placeholder attribute

<input type="text" placeholder="Type your name">