谁能告诉我下面的代码做错了什么?
<table>
<tr>
<td>
<input type="radio" name="rinput">$100 <br>
<input type="radio" name="rinput">$200 <br>
</td>
</tr>
</table>
<script>
$('table').click(function () {
$('input[type="radio"]').each(function() {
if($(this).is(':checked')) {
var text = $(this).nextUntil('br').text();
alert(text);
}
});
});
</script>
基本上我试图在当前元素“$(this)”和下一个元素“br”之间获取文本,如果它被选中的话。