Skip to content
Permalink
248117ea91
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (23 sloc) 998 Bytes
let usernameInput = document.querySelector("#usernameInput");
let statusInput = document.querySelector("#statusInput");
let profilePicInput = document.querySelector("#profilePicInput");
let profileSaveInput = document.querySelector("#saveProfile");
// setting the input values default
usernameInput.value = localStorage.getItem('userName');
statusInput.value = localStorage.getItem('userStatus');
function saveProfileImageLocally() {
if (profilePicInput.files && profilePicInput.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
localStorage.setItem("userProfilePic", reader.result);
}
reader.readAsDataURL(profilePicInput.files[0]);
}
}
profileSaveInput.addEventListener('click', function(e) {
e.preventDefault();
console.log(usernameInput.value);
localStorage.setItem("userName", usernameInput.value);
localStorage.setItem("userStatus", statusInput.value);
saveProfileImageLocally();
});