My application is trying to show a text watermark in a textbox on a form, but I don't want to touch the actual value of the box. So, I'm trying to use a background image with the watermark text, using classes;
.watermarkon input
{
background-image: url('../forms/images/TypeNameWatermark.png');
background-repeat:no-repeat;
}
.watermarkoff input
{
background-image: none;
}
I'm setting the textboxes CssClass="watermarkon" in the form, and when such an element is clicked, I'd like to remove the "watermarkon" and replace with "watermarkoff" or even just remove the existing class. I've tried a ton of different attempts at the Syntax, and though I can capture the click event fine, the page never seems to update the element's CSS. Here is my latest attempt:
jQuery(document).ready(
function() {
jQuery(".watermarkon input").click(function(event) {
jQuery(this).removeClass("watermarkon").addClass("watermarkoff");
});
}
);
Can anyone tell me what I'm missing - why I can't seem to get the CSS change to update the live web page?
Thanks in advance!