<form class="add">
<input type="text" name='content' >
<input type="submit" value="添加">
</form>
<script>
var $form_add = $('.add');
var store_thing = [];
$form_add.submit(function(e){
var new_thing = {};
e.preventDefault();
var $input = $(this).find('input[name=content]');
new_thing.content = $input.val();
console.log('new',new_thing);
add(new_thing);
})
function add(new_thing){
store_thing.push(new_thing);
store.set('store_thing',store_thing);
}
var re = store.get('store_thing');
console.log('store_thing',re);
</script>
大话西游666
相关分类