https://zhidao.baidu.com/question/83338557.html $('input[name="merchantIds"]').click(function () { var checks = document.getElementsByName("merchantIds"); var chkStr = 0; for(var i = 0;i<checks.length;i++){ if(checks[i].checked) chkStr += checks[i].value+","; } alert(chkStr); })