I'm using the follow jQuery code to style some inputs based on whether they are focused or if they have content in them.
$('.Textbox')
.focus(function() { $(this).addClass("selected") })
.blur(function() { if ($(this)[0].value == '') { $(this).removeClass("selected") } });
My problem is that some of my inputs are automatically filled in by the browser if the user is a returning visitor. Like username and password fields for example. Since the inputs have a value entered in them, I want to style them differently. Unfortunately the jQuery won't apply the styles until the user interacts with the input directly.
Is there any way that I can look to see if the input has a value (without the user interacting with the input) and then give it a class name?
Any help would be greatly appreciated.
changeevent