This almost works. However, when leaving the field \"defaulttext\" appears rather than the original text value. Not sure how to most efficiently echo the variable inside default
var q = $('#q'); q.focus(function() { if ($(this).attr('data-default') == $(this).val()) { $(this).val(''); } }).blur(function() { if($(this).val() == '') { $(this).val($(this).attr('data-default')); } });