我想根據HR標記從不同的DIV中的Web服務接收到的文章(= HTML內容)。使用基於HR標記的Javascript/JQuery拆分HTML中的HTML
我用一個例子來解釋,這是我從服務接收:
<p>This is an article bla bla</p> <hr/> <p>this is the next page of the article blabla ...</p>
我要打的基礎上,HR-標籤:
<div><p>This is an article bla bla</p></div>
<div><p>this is the next page of the article blabla ...</p></div>
我嘗試了不同的用腦,是行不通的。我怎麼能用Javascript或JQuery(或用另一種方法;-))來做到這一點?
謝謝!它很棒! – benske
Oke這是接受知道(我不知道這個選項:-)) – benske
但你最好小心拼寫變化,如'
','
'等。一個正則表達式會導致變化更穩健。查看此答案的示例:http://stackoverflow.com/a/40115509/263832 – xr280xr