日期:2014-05-16  浏览次数:20378 次

jquery 怎样获取select 的id?
jquery 怎样获取select 的id?
例如:<td><label for="area_code">地区:</label></td>
<td >
<select id="area_code" name="area_code">
</select>
  </td>
我想在javascript中获取"area_code" 这个字符串,怎么获取?

------解决方案--------------------
$("#area_code").attr("id");直接搞定了。别想别的了,给分吧。
------解决方案--------------------
5楼的是可以的。不要想太多了,直接通过属性取值就行了。

$("元素").attr("属性值")
------解决方案--------------------
$("select").attr("id")