Detecting Chrome Saved Input Information with Jquery? -


i'm using jquery develop placeholder text on input fades when input gets focus, , disappears when users types. part works fine. so, avoid conflict saved text, wrapped code in:

 if(!$($input).val()) {  ...create placeholder, set rules fading it, etc...  } 

if user has saved password example, in firefox, browser detect input has value , not create placeholder text.

in chrome, however, chrome not load saved value until after page 'done' loading... means detects input empty, creates placeholder text, , after page loaded, places saved value in input--leading placeholder , password being on top of each other.

how can detect chrome filling out form avoid unfortunate overlap?

in end, noticed chrome doesnt trigger sort of event upon autofilling, if wait until window.load , check if input has -webkit-autofill can check them then. can see i'm using debouncer (ben alman - http://benalman.com/projects/jquery-throttle-debounce-plugin/) wait further 200 milliseconds after window.load hasn't put in autofill text yet...

$(window).load($.debounce(200, function () {         if ($('input:-webkit-autofill')) {             // know form has autofill on way. let's check again after delay not done on window.load             $('input:-webkit-autofill').each(function () {                 if ($(this).val() !== "") {                    $(this).parent().find('label').hide();                }             });         }      })); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -