tags:

views:

234

answers:

3

How do I create a text box that displays hint on the right when in focus?

Example : http://www.airbnb.com/rooms/new (click on the address text box)

+2  A: 

This can be done using javascript. If don't want to code it yourself you can use something like this http://nicolae.namolovan.googlepages.com/jquery.inputHintBox.html

Tim
A: 

If jQuery is fine for you I think this was once already answered over here:

http://stackoverflow.com/questions/1874067/jquery-form-tooltip

tillinberlin
A: 

It's also possible without javascript.

<input type="text" value="Focus me to see a hint!" style="width: 200px; height: 30px;"/>
<div>Congratulations, you found me !</div>

.input + div {
    display: none;
    position: relative;
    top: -30px;
    left: 200px;
}

.input:focus + div {
        display: block;
}

Enjoy ;)

Daan