兴趣,爱好,选中值拼接
//兴趣爱好,循环取选中的值,拼接 var cks = ""; $(":checkbox:checked").each(function () { cks += $(this).val() + ","; }); cks = cks.substr(0, cks.length - 1);
<div class="mb10"> 兴趣爱好: <input type="checkbox" id="ck1" name="cks" value="钢琴" />钢琴<input type="checkbox" id="ck2" name="cks" value="打球" />打球<input type="checkbox" id="ck3" name="cks" value="游泳" />游泳<input type="checkbox" id="ck4" name="cks" value="滑雪" />滑雪 </div>