gpt4 book ai didi

javascript - 使用用户脚本单击表中的 td

转载 作者:行者123 更新时间:2023-12-03 00:08:55 26 4
gpt4 key购买 nike

它看起来像一个单选按钮,但实际上只是一个 td。我知道如何选择常规单选按钮,但如何选择 td?

$('input[value="no"]').click();

<小时/>

表格代码如下所示:

<table align="center" width="90%" class="hoverTable">
<tr style="height: 50px">
<td width="85%"><span title="Commonsense about social situations. For example: situations that involve other people and evoke emotions of anger, laughter etc." class="tt">Social Commonsense</span>?</td>
<td align="center" width="8%">
YES
</td>
</tr>

<tr style="height: 50px">
<td><span title="Commonsense about the physical world. E.g. cars are smaller than garages." class="tt">Physical Commonsense</span>?</td>
<td align="center">
NO
</td>
</tr>

<tr style="height: 50px">
<td><span title="Commonsense about the biological world. For example: plants are fixed in location, people need to eat food to survive etc." class="tt">Biological Commonsense</span>?</td>
<td align="center">
NO
</td>
</tr>

<tr style="height: 50px">
<td><span title="Commonsense about how the world works. For example: countries have states, babies crawl before walking etc." class="tt">Man-Made Constructs Commonsense</span>?</td>
<td align="center">
YES
</td>
</tr>

<tr style="height: 50px">
<td><span title="The order in which events occur in time. For example: you need to turn ignition on before driving a car" class="tt">Temporal Order</span> of events?</td>
<td align="center">
NO
</td>
</tr>

<tr style="height: 50px">
<td><span title="Commonsense about which agent / person performs the required action. For example: If Person1 apologizes to Person2, Person2 accepts the apology, not Person1." class="tt">Agent-Action Commonsense</span>?</td>
<td align="center">
NO
</td>
</tr>
<tr style="height: 50px">
<td><span title="Commonsense about where certain events can happen. For example: people typically eat in a restaurant, play in the park etc." class="tt">Spatial / Location Commonsense</span>?</td>
<td align="center">
NO
</td>
</tr>
</table>

最佳答案

我想你使用 jQuery ?

   $('.hoverTable td').click(function() {
var inVal = $(this).html();
var newVal = inVal=='NO'?'YES':'NO';
$(this).html(newVal)
});

关于javascript - 使用用户脚本单击表中的 td,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54837191/

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