gpt4 book ai didi

javascript - 如何使用 jQuery :contains(some text) selector but only select "some text" from "this is some text"?

转载 作者:行者123 更新时间:2023-11-30 18:12:41 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Find text string in jQuery and make it bold

如何使用 jQuery :contains(some text) 选择器,但只从“this is some text”中选择“some text”?

我有这样的东西:

<div class="search">this is some text</div>

我目前正在使用这样的代码:

$("div.search:contains(some text)").css("text-decoration","underline");

但这强调了“这是一些文本”,我希望它只强调“一些文本”。

我怎样才能最简单地完成它?

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