遍历select的下面所有input的值

页面代码:<label>

     星期一<select class="weekType"><option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="monday">瓶,
     星期二<select class="weekType"><option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="tuesday">瓶,
     星期三<select class="weekType"><option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="wednesday">瓶,
     星期四<select class="weekType"><option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="thursday">瓶,
     星期五<select class="weekType"><option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="friday">瓶,
     星期六<select class="weekType"><<option value="0">上午option>
     <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="saturday">瓶,
    星期日<select class="weekType"><option value="0">上午option>
    <option value="1">下午option><option value="2">晚上option>select>配送<input class="sendInput week" min="3" type="number" id="sunday">label>
js获取各个option中的内容:
var weeks= $(".week");
var timeType = $(".weekType");
for(var w=0;w < weeks.length;w++){
    console.log(weeks.eq(w).val());
    if(weeks.eq(w).val() !=null && weeks.eq(w).val() >= 3){
        arr.push({
            "time": w+1,
            "onceAmount": weeks.eq(w).val(),
            "timeType":timeType.eq(w).val()
        })
    }
}


你可能感兴趣的:(前端)