我需要在頁面重新加載後保存複選框狀態。我的查詢字符串:頁面重新加載後狀態複選框
Mathes=1&Mathes=2&Mathes=3&Rols=2&Users=1&.......
我怎樣才能得到這些數據?我寫了一些代碼:
$(document).ready(function() {
var value = window.location.href.match(/[?&]Matches=([^&#]+)/);
$('input[name=Mathes]').each(function (index) {
if (value[1] === $(this).val()) {
$(this).attr('checked', 'checked');
}
});
});
但是我只能得到第一個元素。我怎樣才能通過所有參數得到它?