2
我有類似這樣的標記:如何在javascript中包圍一段文本的範圍?
<p>one two three four</p>
而且我想使用JavaScript將其轉換爲這樣的:
<p>one <span>two three<span> four</p>
我已經偏移和段的長度我想在一個跨度來包裝,在這種情況下爲offset = 4
和length = 9
。如果使用jQuery可以使它更容易,那更好。