select 下拉框获取多值
select下拉框选中,获取选中option的多个属性值
<label class="col-sm-3 control-label is-required">试卷名称:</label> <div class="col-sm-8" > <input type="hidden" id="paperName" name="paperName"/> <input type="hidden" id="paperDuration" name="paperDuration"/> <select id="paperId" name="paperId" class="form-control m-b"> <option value="">请选择</option> <option th:each="paper:${papers}" th:value="${paper.paperId}" th:paperTime="${paper.examTotalTime}" th:text="${paper.paperName}"></option> </select> </div>
var paperName = $("#paperId option:selected").text(); var paperTime = $("#paperId option:selected").attr("paperTime");