checkbox獲取多選框,創建本地存儲

2017年11月17日

checkbox獲取多選框,創建本地存儲

//本地存儲對象和數組都需要轉JSON字符串JSON.stringify
var disease = [];
$('input[name="operation"]:checked').each(function(){ 
  disease.push($(this).val()); 
});
localStorage.setItem('oper',JSON.stringify(disease));
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章