# Creating text field where text disappears upon click

**URL:** <https://www.ruby-forum.com/t/creating-text-field-where-text-disappears-upon-click/128042>\
**Category:** Rails\
**Created:** [February 4, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/creating-text-field-where-text-disappears-upon-click/128042 "2008-02-04T16:30:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 4, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/creating-text-field-where-text-disappears-upon-click/128042/1 "2008-02-04T16:30:50Z")

</div>

Hi,

Is there a slick way in Rails to create a username text field in which  
it starts out reading, “Enter your username” and once you click on the  
text field, the “Enter your username” text disappears?

Thanks, - Dave

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 4, 2008, 4:55pm UTC](https://www.ruby-forum.com/t/creating-text-field-where-text-disappears-upon-click/128042/2 "2008-02-04T16:55:01Z")

</div>

I don’t know of a slick way (yet) but here’s the HTML to produce said  
results

On Feb 4, 9:28 am, “removed\_email\_address@domain.invalid”
