You can use the new HTML5 placeholder attribute.
Edit : update to use another hot HTML5 / jQuery, HTML5 data storage.
<input type="text" placeholder="type here" data-placeholder-text="type here" />
This will work in all modern browsers. And gracefully degrades in IE. However, for IE you will have to use javascript.
$(document).ready(function() { var $input = $('#id_of_input_element'); $input.focus(function() { if($(this).val() == $(this).data('placeholder-text')) { $(this).val('') } }).blur(function() { if($(this).val() == '') { $(this).val($(this).data('placeholder-text')); } }).trigger('blur'); }):
xzyfer
source share