Вот мой ответ на другой вопрос:
Он использует комбинацию jQuery и CSS3. Работает точно так же, как атрибут заполнителя html5! .
- Прячется сразу при вводе первой буквы
- Показывается снова, когда вы удаляете то, что вводите в него
HTML:
<div class="placeholder" contenteditable="true"></div>
CSS3:
.placeholder:after {
content: "Your placeholder"; /* this is where you assign the place holder */
position: absolute;
top: 10px;
color: #a9a9a9;
}
JQuery:
$('.placeholder').on('input', function(){
if ($(this).text().length > 0) {
$(this).removeClass('placeholder');
} else {
$(this).addClass('placeholder');
}
});
ДЕМО: http://jsfiddle.net/Tomer123/D78X7/