localstor
parent
0439586e2b
commit
83837d5751
@ -0,0 +1,15 @@
|
||||
//store form's value in localStorage
|
||||
|
||||
var f = document.querySelector("form#avatar_form")
|
||||
f.onchange = updateAvatar
|
||||
|
||||
document.querySelector("#player1").onchange = updateAvatar
|
||||
document.querySelector("#player2").onchange = updateAvatar
|
||||
|
||||
function updateAvatar () {
|
||||
console.log("CHANGE");
|
||||
var fd = new FormData(f)
|
||||
var avatar=fd.get("player_avatar")
|
||||
console.log("avatar", avatar);
|
||||
localStorage.myavatar=avatar
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
//store form's value in localStorage
|
||||
|
||||
var f = document.querySelector("form#avatar_form")
|
||||
f.onchange = updateAvatar
|
||||
|
||||
document.querySelector("#player1").onchange = updateAvatar
|
||||
document.querySelector("#player2").onchange = updateAvatar
|
||||
|
||||
function updateAvatar () {
|
||||
console.log("CHANGE");
|
||||
var fd = new FormData(f)
|
||||
var avatar=fd.get("player_avatar")
|
||||
console.log("avatar", avatar);
|
||||
localStorage.myavatar=avatar
|
||||
}
|
Loading…
Reference in New Issue