获取select下被option选中的id值可用如下代码:
$("select option:checked").attr("id")
示例如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style>
select{width:200px;height:30px;border:1px solid green;border-radius:5px;}
</style>
<script>
$(function(){
$("select").change(function() {
alert($(this).find("option:checked").attr("id"));
});
})
</script>
</head>
<body>
<select>
<option value="12" id="56">89</option>
<option value="23" id="45">78</option>
<option value="34" id="34">67</option>
</select>
</body>
</html>显示效果