:jquery获取多个radio中的name相同的选中input值

转载网址:http://blog.sina.com.cn/s/blog_694448320100mtsn.html

将下面这段代码放到$().ready(
function(){
$("#tableList tr").click(function() {
             $("input[name='modelId']").each(function(){
        if($(this).attr("checked")){
            alert($(this).val());
        }
    });
           });
}
)
 
<table>
<tr>
<td><input name="modelId" value="aa" checked="checked"/></td>
</tr>
<tr>
<td>><input name="modelId" value="aa" checked="checked"/></td>
</tr>
</table>
 

你可能感兴趣的:(jquery)