.find () 从父元素查找子元素:
<script type="text/javascript">
var find = function(){
var val = $("#tclx").find("option:selected");
if(val!=null)
{
alert("value>>>"+val.val());
alert("text>>>"+val.text()); //双标签里的文本
}
var nx = $("#ns").find("input[name='nx']:checked");
if(nx!=null)
{
alert("年限代码:"+nx.val());
alert("年限名:"+nx.text()); //""
}
}
$(document).ready(function(){
$("#sb").bind("click",function(){
find();
});
});
</script>
</head>
<body>
<div align="center"></div>
<table width="50%" align="center">
<tr>
<td align="right">
套餐类型:
</td>
<td align="left">
<select id="tclx">
<option value="" selected="selected">-请选择-</option>
<option value="01">宽带a</option>
<option value="02">宽带b</option>
<option value="03">套餐c</option>
<option value="04">套餐d</option>
</select>
</td>
</tr>
<tr>
<td align="right">
开通年限:
</td>
<td align="left" id="ns">
<input type="radio" name="nx" value="11" >一年
<input type="radio" name="nx" value="12" >两年
<input type="radio" name="nx" value="13" >三年
</td>
</tr>
<tr>
<td align="right">
<input type="button" id="sb" value="提交" />
</td>
<td align="left">
<input type="button" id="sb" value="重置" />
</td>
</tr>
</table>