As shown below:
<select id="city"> <option value="beijing">北京</option> <option value="shanghai">上海</option> <option value="shenzhen">深圳</option> </select> $(function(){ $("#city").change(function(){ ①// 已获取select为当前this元素 }) })
If you want to get the value of the selected option in ①, you can use the following method
$("#city option:selected").val(); //使用选择器 $(this).children('option:selected').val() //使用this
Sometimes we take it for granted and write $(this "a"), $ ("this a") etc., this is wrong