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
This is working! I use it myself:
/* Forminputs löschen und wiederherstellen */
jQuery(function() {
var input = jQuery('#userForm input[type=text], #userForm textarea');
input.focus(function() {
jQuery(this).attr('data-default', jQuery(this).val());
jQuery(this).val('');
}).blur(function() {
var el = jQuery(this);
if (el.val() == '')
el.val(el.attr('data-default'));
});
});