Skip to content

Instantly share code, notes, and snippets.

@kennyLtv
Created July 20, 2018 16:26
Show Gist options
  • Save kennyLtv/19d5504a0eaa6187b64f2d7d73973e3e to your computer and use it in GitHub Desktop.
Save kennyLtv/19d5504a0eaa6187b64f2d7d73973e3e to your computer and use it in GitHub Desktop.
Insert random 12 character string into DOM element by ID
/*
* @Author: kennyL
* @Date: 2018-07-20 11:47:19
* @Last Modified by: kennyL
* @Last Modified time: 2018-07-20 12:16:05
*/
window.addEventListener("load", makePassword);
function makePassword() {
document.getElementById("password").innerHTML = btoa(Math.random()).substr(5, 12);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment