I have a script that displays username and password as background
images in the input fields when the field is empty and they removes it
when on focus (or when there's content left in the field). I then came
up against the issue where if someone's browser populates the input
fields after their browser is asked to remember their password and I
end up with both the input fields being populated and the background
showing.  Here's my initial script:

$(document).ready(function() {
  $('#loginArea').addClass('active');
  $('#loginArea.active input')
    .focus(function() {
      $(this).addClass("nobg");
    })
    .blur(function() {
      if ($(this).val() == '') {
        $(this).addClass("nobg");
      };
   });
});

I tried using
  $('#loginArea.active input:empty').removeClass("nobg");
but FF doesn't add the username/password until after the page has
loaded (I don't know what other browsers are doing), and thus the
decision to addClass is based on empty cells.

Anyone have an idea of how to resolve this one?

Reply via email to