我想根据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