gpt4 book ai didi

jquery;-isvisibility 使用visible() 我如何选择第一个可见tr的单选按钮

转载 作者:行者123 更新时间:2023-12-01 06:39:05 27 4
gpt4 key购买 nike

我的表如下所示。通过使用 visible() 如何选择两个不同 div(hidden_​​source1 和hidden_​​source2)上第一个可见 tr 的单选按钮?我已经这样做了,首先,在两个 div 中 tr 是否可见并进行检查,其次,如果找到可见的 tr,请单击该 div 中的单选按钮。

<HTML>
<title></title>
<head>
<script type="text/JavaScript">
<tab>$(document).ready(function(){
<tab>$("#hidden_source1").find( "input", ".rower:visible" )[0].checked = true;
<tab>$("#hidden_source1").find( "input", ".rower:visible" )[0].click
});
<tab>$(document).ready(function(){
<tab>$("#hidden_source2").find( "input", ".rower:visible" )[0].checked = true;
<tab>$("#hidden_source2").find( "input", ".rower:visible" )[0].click
});
</script>
</head>
<body>
<div id="hidden_source1">
<table id="return_me" class="tbl2" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
</tbody>
</table>
</div>
<div id="hidden_source2">
<table id="return_me" class="tbl2" cellspacing="0" cellpadding="0" border="0" width="100%">
<tbody>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: none;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
<tr class="rower" style="display: table-row;">
<td width="4">&nbsp;</td>
<td width="30">
<input class="return_r" type="radio" name="return">
</td>
</tr>
</tbody>
</table>
</div>

</body>
</HTML>

最佳答案

您还可以使用

$(function(){
$('tr.rower:visible:first input').attr('checked', true);
});

关于jquery;-isvisibility 使用visible() 我如何选择第一个可见tr的单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7796690/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com