但我不确定如何在div标签
中显示输入的webstorage值显示表单值---第一项
你能告诉我如何解决它..
https://jsfiddle.net/r977y9zb/10/
$(document).ready(function() {
init();
});
function init() {
if (localStorage["name"]) {
$('#name').val(localStorage["name"]);
}
if (localStorage["email"]) {
$('#email').val(localStorage["email"]);
}
if (localStorage["message"]) {
$('#message').val(localStorage["message"]);
}
$('.stored').keyup(function() {
localStorage[$(this).attr('name')] = $(this).val();
});
$('#localStorageTest').submit(function() {
localStorage.clear();
});
}
答案 0 :(得分:0)
以下是一些可能对您有所帮助的帮助函数:
case 6:
case 7:
echo "Weekend";
break;
用法:
function setLocal(key, value) {
localStorage.setItem(key, value);
}
function getLocal(key) {
return localStorage.getItem(key);
}
function getAllLocal() {
var tmp_obj = {};
for(var key in localStorage)
tmp_obj[key] = localStorage.getItem(key);
return tmp_obj;
}