学习整理使用jquery实现获取相同name被选中的多选框值的方法
<html>
<head>
<meta charset="gbk">
<script src="https://www.qipa250.com/jquery/dist/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<input type="checkbox" value="橘子" name="qipa250">橘子1</input>
<input type="checkbox" value="香蕉" name="qipa250">香蕉1</input>
<input type="checkbox" value="西瓜" name="qipa250">西瓜1</input>
<input type="checkbox" value="芒果" name="qipa250">芒果1</input>
<input type="checkbox" value="葡萄" name="qipa250">葡萄1</input>
<input type="button" value="方法2" id="b2">
</body>
<script>
$("#b2").click(function(){
var name= "";
$("input:checkbox[name='qipa250']:checked").each(function () {
name+= $(this).val() + " ";
});
});
</script>
</html>