Are there any text selector in jquery?

前端 未结 3 1460
野的像风
野的像风 2021-01-25 00:22

Are there any text selector in jquery ?

My Code

Hello World! Hello World!

Reslut Should be (Using Jque

3条回答
  •  花落未央
    2021-01-25 00:56

    You can do a regex replacement, etc for your simple case, but for a more general answer: no.

    jQuery just doesn't provide much help when dealing with text nodes, it's designed primarily for dealing with element node types (nodeType == 1), not text node types (nodeType == 3)...so yes you can use it where it helps (e.g. .contents() and .filter()), but that won't be often since it's not the library's main purpose.

提交回复
热议问题