前言:
获取值的方式有很多种,找的自己喜欢的那一种
新的方式获取下拉框的值
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<select name="aa">
<option value="1">选项1</option>
<option value="2">选项2</option>
</select>
<script src="jquery.min.js"></script>
<script>
$("select[name='aa']").change(function(){
console.log($(this).val())
});
</script>
</body>
</html>
2019-03-12追加
获取到后台的数据反显在页面上
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<select name="sel">
<option value="1">800M</option>
<option value="2">1.8G</option>
</select>
<script src="jquery.min.js"></script>
<script>
$('select[name=sel]').val(2);
</script>
</body>
</html>