gpt4 book ai didi

javascript - Jquery:内容搜索错误

转载 作者:行者123 更新时间:2023-12-02 20:10:37 25 4
gpt4 key购买 nike

我在搜索文本时遇到问题。我认为是 Ja,因为有空格

这是我的有效脚本。

$('td > a:contains("Hallow")').each(function(){
if($(this).parent().next('td').text() == 'Secured') {
alert("working well")
}
else {
alert($(this).text());
}
});

没有空格,我的脚本正在运行:http://jsfiddle.net/FrE9Q/7/

<td width="140" align="right">Secured</td>

没有空格

<小时/>

这是带有空格的真实 html,但我的脚本无法正常工作:http://jsfiddle.net/FrE9Q/8/

        <td width="140" align="right">
Secured
</td>

空格...

感谢您的帮助。

最佳答案

然后使用$.trim [docs]删除尾随和前导空格。 :

if ($.trim($(this).parent().next('td').text()) === '...')

关于javascript - Jquery:内容搜索错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6998936/

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