Yeej, dikke bump. Maar dit is best handig (zojuist gemaakt).
$('input[type=text]').each(function() {
var $t = $(this),
deftext = $t.attr('data-default-value');
$t.val(deftext).css({
'font-style': 'italic',
'color': '#b3b5b7'
});
$t.bind('focus blur', function() {
if($t.val() == deftext) {
$t.val('').css({
'font-style': 'normal',
'color': '#000'
});
} else if ($t.val() == '') {
$t.val(deftext).css({
'font-style': 'italic',
'color': '#b3b5b7'
});
}
});
});
Maar... had html5 hier niet standaard ondersteuning voor? :')