I have a login page on which I am trying to toggle the display of a button to allow the user to modify their roles (pick from a list of their user’s available roles).
I am hiding the button initially and showing it on $("#txtUsername").blur().
My question: is there a way to pick up a Chrome Autofilled value?
If I try to trigger it on document ready, the value is blank, and the button doesn’t show.
$(function () {
$("#btnRoles").hide();
$("#txtUsername").blur(function () {
if ($(this).val()) $("#btnRoles").show();
else $("#btnRoles").hide();
}).trigger("blur");
});
But the textbox is then filled in via Autofill. Any ideas?
I couldn’t find anything to read the values specifically after the page had loaded. I ended up forcing the focus on the textbox by using
$("#txtUsername").trigger("focus"), so when the user did anything it would call.blur()and fill in the roles.