<asp:UpdatePanel ID="pnlParent" runat="server" UpdateMode="Conditional" ClientIDMode="Static">
<ContentTemplate>
<div class="hidOverflow smallPad">
<div class="setFloatL halfWidth vertAlignT">
<span class="profileLabel">Contact Number:</span>
</div>
<div class="setFloatL vertAlignT">
<asp:Label ID="lblCliDate" ClientIDMode="Static" runat="server" Text="" CssClass="profileLabelValue"></asp:Label>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
$(document).ready(function (e) {
$("body").on("hover", ".profileLabel" , function () {
alert($(this).next(".profileLabelValue").text());
});
});
当鼠标悬停在 profileLabel
类 span
上时,我希望显示 profileLabelValue
类 span
的文本。使用我的代码,什么也没有发生。
我怎样才能做到这一点,因为我目前尝试的方法不起作用。
最佳答案
所以我不得不使用 mouseover
而不是 hover
。
我把代码改成了这样:
$(document).ready(function () {
$("body").on("mouseover", ".profileLabel", function (e) {
alert($(this).parent().next("div").find("span").first().text());
});
});
以防将来有人需要它。
关于jquery - 悬停在另一个跨度上时如何显示下一个跨度文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29562290/