Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect when browser places saved password?

I'm trying to detect when a browser places a saved username and password into the input fields. I've looked at this post , but I don't have the option to change this functionality, and the other solutions on don't work.

Basically, I have a disabled login button if the fields are empty on load. But when a browser fills in the input, it doesn't enable the button. I'm trying to find how to see if it changes.

I'm using jQuery and JS.

I've tried .change, on .ready, on .load, and all. It seems to happen after the .load event.

Does anyone know a solution to this? I would like to avoid using any sort of timeout.

like image 972
streetlight Avatar asked Jan 30 '26 01:01

streetlight


1 Answers

I think there is no way to detect if the browser has some buil-in feature that pre-populates the fields.

You could solve the problem with the a timer that enable the button, if something is there. Something like this:

setInterval(function (){
 if($("#username").val()!=""){
  $("#loginbutton").attr("enabled","enabled"); 
 }
},1000)
like image 137
Simon Edström Avatar answered Feb 01 '26 15:02

Simon Edström