如何查找字符串並使用jQuery將其包裝爲span?例如,使用jQuery替換帶span的文本字符串
<p>
<span class="span1">afijaifjiaj</span>
ajfijaogoag
<span class="span1">afijaifjiaj</span>
aokaodgg
<span class="span1">afijaifjiaj</span>
</p>
我希望把它作爲:
<p>
<span class="span1">afijaifjiaj</span>
<span class="span2">ajfijaogoag</span>
<span class="span1">afijaifjiaj</span>
<span class="span2">aokaodgg</span>
<span class="span1">afijaifjiaj</span>
</p>
嘗試使用這個選擇:$( '*:包含了( 「我是一個簡單的字符串」)'); –