下拉列表设置
HMTL代码
1 <select id="category" name="category"> 2 <option value="">请选择类别</option> 3 <option value="1">类别1</option> 4 <option value="2">类别2</option> 5 <option value="3">类别3</option> 6 <option value="4">类别4</option> 7 </select>
JS代码
1 <script src="static/js/jquery-3.1.1.min.js"></script> 2 <script type="text/javascript"> 3 $('#category option[value=3]').attr('selected',true); 4 </script>