$(document).ready(
function
() {
$.cookie.json =
true
;
var
data_obj = $.cookie(
"test_4"
);
for
(key
in
data_obj) {
$(
"#hyouji_4"
).append(key +
":"
+ data_obj[key] +
"\\n"
);
}
$(
"#cook_4"
).click(
function
(){
data_obj = {};
for
(i=1;i<=3;i++) {
data_obj[$(
"#input_4_"
+i).attr(
"name"
)] = $(
"#input_4_"
+i).val();
}
$.cookie(
'test_4'
, data_obj);
});
});
<input type=
"hidden"
id=
"input_4_1"
name=
"iti"
value=
"Fuji"
/>
<input type=
"hidden"
id=
"input_4_2"
name=
"ni"
value=
"Taka"
/>
<input type=
"hidden"
id=
"input_4_3"
name=
"san"
value=
"Nasubi"
/>
<input type=
"button"
id=
"cook_4"
value=
"data_4保存"
/>
<div id=
"hyouji_4"
></div>