I have a textbox I want to change the watermark on focus.
Please correct me:
$('body').ready(function() {
$('#edit-submitted-full-name').focus(function() {
$(this).css({background:'#FFFFFF'});
});
$('#edit-submitted-full-name').blur(function() {
if ($(this).val() == '') {
$(this).css({background:'url("images/text_fullname.png") no-repeat scroll 7px 5px #FFFFFF'});
};
});
});
you can probably do this more cleanly using a css class and avoid having to handle the path to your images. If you added a new css class called “hintable” to everything you wanted to have or not have a hint it would be doubly better.
HTMl
CSS:
and then your code would look like: