gpt4 book ai didi

c# - 单击时突出显示特定的 div 文本

转载 作者:太空宇宙 更新时间:2023-11-04 04:27:05 25 4
gpt4 key购买 nike

我有以下 HTML。

<div id = "aa">
<table width="100%">
<tbody>
<!-- ngRepeat: msg in globalChat -->
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="8">
<td class="ng-binding" ng-1375781897068="9">
A
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="10">
<td class="ng-binding" ng-1375781897068="11">
B
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="12">
<td class="ng-binding" ng-1375781897068="13">
C
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="14">
<td class="ng-binding" ng-1375781897068="15">
D
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="16">
<td class="ng-binding" ng-1375781897068="17">
E
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="18">
<td class="ng-binding" ng-1375781897068="19">
F
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="20">
<td class="ng-binding" ng-1375781897068="21">
G
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="22">
<td class="ng-binding" ng-1375781897068="23">
H
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="24">
<td class="ng-binding" ng-1375781897068="25">
I
</td>
</tr>
<tr class="ng-scope" ng-repeat="msg in globalChat" ng-1375781897068="26">
<td class="ng-binding" ng-1375781897068="27">
J
</td>
</tr>
<tr class="ng-scope" ng-repeat="ms`enter code here`g in globalChat" ng-1375781897068="28">
<td class="ng-binding" ng-1375781897068="29">
K
</td>
</tr>
</tbody>
</table>
</div>

我已经使用 AngularJS 来呈现值

我只是希望,如果我单击 div 中的任何文本,那么只有该特定文本应该在 div 中突出显示。通过单击 div 中的其他文本,应取消选择先前选择的文本并选择新文本。我该怎么做?

最佳答案

这是你要找的吗:

http://jsfiddle.net/bT8vs/

jQuery:

$(document).ready(function(){
$('div p').click(function(){
$('div p').css("background-color", "transparent");
$(this).css("background-color", "yellow");
});
});

关于c# - 单击时突出显示特定的 div 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18076887/

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