jquery获取checkbox 选中的值
- <ul id="reason_ul">
- <input name="reason" type="checkbox" value="1"><span>产品使用一段时间后不工作了</span>
- <input name="reason" type="checkbox" value="2"><span>产品一收到就是坏的</span>
- <input name="reason" type="checkbox" value="3"><span>产品不能开机或自己启动</span>
- <input name="reason" type="checkbox" value="4"><span>产品不能充电</span>
- <input name="reason" type="checkbox" value="5"><span>产品外观非人为改变</span>
- <input name="reason" type="checkbox" value="6"><span>产品的内部或外部的损坏</span>
- <input name="reason" type="checkbox" value="7"><span>其他</span>
- </ul>
jquery代码
- function do_submit() {
- var reason_arr = new Array();
- $.each($("input[name='reason']"), function(){
- if(this.checked){
- reason_arr[i] = $(this).val();
- }
- });
- var vals = reason_arr.join(",");
- console.log(vals);
- }
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17