Mahngiel Posted March 14, 2013 Share Posted March 14, 2013 I could probably figure it out if I knew what to call it. My google-foo has failed. Is there an event handler for when a user selects an option from their browser's remembered form data? I've gone through keyup, change, click, blur, and select Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/ Share on other sites More sharing options...
Psycho Posted March 14, 2013 Share Posted March 14, 2013 Considering that would be behavior specifically implemented within each browser and not a valid HTML event, I doubt there is one. You could use onchange to determine when the field is changed, but you wouldn't know if the value entered was manually entered vs. selected from the browser lookup. Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/#findComment-1418541 Share on other sites More sharing options...
Solution ignace Posted March 14, 2013 Solution Share Posted March 14, 2013 (edited) tl;dr Browsers do not fire any event when autocompleting the form fields. All I could find is that onchange should be the one to be called, nothing specific for the autocomplete though. I found this: https://code.google.com/p/chromium/issues/detail?id=42716 Which says that in Chrome it should fire the onchange event. The posted example: http://jsfiddle.net/bevancoleman/6SRYH/ Does not appear to fire the onchange event but instead fires the oninput event (chrome, mac), which is the same as onchange? There is a jQuery plugin for this though: http://furrybrains.com/2009/01/02/capturing-autofill-as-a-change-event/ Haven't tried it. Other things I found was: http://avernet.blogspot.co.at/2010/11/autocomplete-and-javascript-change.html http://stackoverflow.com/questions/4938242/browser-autofill-and-javascript-triggered-events I searched for "form autocomplete event" and "form autofill event" Edited March 14, 2013 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/#findComment-1418548 Share on other sites More sharing options...
Mahngiel Posted March 14, 2013 Author Share Posted March 14, 2013 Aah, yes 'Autofill'. I appreciate the feedback and useful links, Ignace, truly helpful. I added input to my bindings and voila (FF 19.0.2) - autofill selection now fires the in response // super generic, over-compensating object mappage $( 'form :input' ).map( function () { // do something on change $( this ).bind( 'keyup change input', function () { } ); } ); Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/#findComment-1418592 Share on other sites More sharing options...
ignace Posted March 14, 2013 Share Posted March 14, 2013 Isn't that the same as: $(':input').bind('keyup change input', function() { // code here }); Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/#findComment-1418616 Share on other sites More sharing options...
Mahngiel Posted March 14, 2013 Author Share Posted March 14, 2013 (edited) Isn't that the same as: $(':input').bind('keyup change input', function() { // code here }); For the most part yes. I stripped out the unnecessary info to my issue (depending on use, you'd really want some specificity) . Sorry if that lead to confusion. Also, one wouldn't want to use :input for this, as it attaches the handlers to submit buttons Edited March 14, 2013 by Mahngiel Quote Link to comment https://forums.phpfreaks.com/topic/275637-is-there-a-js-jq-event-handler-for-this/#findComment-1418671 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.