i want to put some description text in light grey in a text field. then when a user clicks on it the text disappears and he can type whatever he wants.
is there a jquery plugin for this? i dont know what to search for in google.
i want to put some description text in light grey in a text field. then when a user clicks on it the text disappears and he can type whatever he wants.
is there a jquery plugin for this? i dont know what to search for in google.
Yes -- what you want is relatively simple to do. Check out the following link:
$(document).ready(function() {
$('#IDofTextField').css({'color': '#aaaaaa', 'font-style': 'italic'});
$('#IDofTextField').attr('value', 'Your text in here');
$('#IDofTextField').focus(function() {
$('#IDofTextField').css({'color': '#000', 'font-style': 'normal'});
$('#IDofTextField').attr('value', '');
});
$('#IDofTextField').blur(function() {
if ($('#IDofTextField').val() == '') {
$('#IDofTextField').css({'color': '#aaaaaa', 'font-style': 'italic'});
$('#IDofTextField').attr('value', 'Your text in here');
}
});
});