相关疑难解决方法(0)

jQuery基于文本选择

我需要在jQuery中根据文本选择一个元素.

例如:

<span>this text</span>
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用.contains()根据文本进行选择,但它并不是唯一的.

我不想选择:

<span>this text and that text</span>
Run Code Online (Sandbox Code Playgroud)

我想选择元素,如果它是元素的唯一文本.

除了使用正则表达式,我如何使用jQuery选择器?

谢谢.

jquery

24
推荐指数
1
解决办法
7502
查看次数

标签 统计

jquery ×1