Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Injection
//generate the javascript content of method cloudpassSetUsername to inject into the current page
function injectSetUsernameFunc(usernameFieldIsId,usernameField){
var js = 'window.cloudpassSetUsername = function(username){';
if(usernameFieldIsId){
js += 'forceChangeField( document.getElementById("'+usernameField+'"), username);';
}else{
js += 'forceChangeField( document.getElementsByName("'+usernameField+'")[0], username);';
}
js += '};';
return js;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.