English 中文(简体)
在<h3>之间插入<div>
原标题:Wrap Multiple <p> elements into <div> between <h3>

我愿利用 j子改造:

<h3>Question 1</h3>
<p>Answer 1 P1</p>
<p>Answer 1 P2</p>

<h3>Question 2</h3>
<p>Answer 2 P1</p>
<p>Answer 2 P2</p>
<p>Answer 2 P3</p>

Into:

<ul>
   <li>
       <h3>Question 1</h3>
       <div>
          <p>Answer 1 P1</p>
          <p>Answer 1 P2</p>
       </div>
    </li>
    <li>
       <h3>Question 2</h3>
       <div>
          <p>Answer 2 P1</p>
          <p>Answer 2 P2</p>
          <p>Answer 2 P3</p>
       </div>
    </li>
</ul>

任何建议都会得到真正的赞赏。

谢谢!

问题回答

有趣! 我急切地等待着不同的解决办法。

从理论上讲,我将使用<代码>$( h3, p.each(logic),通过所有这些项目,并在我碰到标签h3时使用。 我将创建li,h3<>>和div,届时我将碰到p。 页: 1





相关问题
PHP DOM - accessing newly added nodes

I use the following to get a html document into DOM: $dom = new domDocument( 1.0 , utf-8 ); $dom->loadHTML($html) and then I add some new content to an element in the html: $element = $dom->...

XML DOM parsing br tag

I need to parse a xml string to obtain the xml DOM, the problem I m facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I m aware this ...

How to get a flash url in a webpage using a webframe?

As we know , When we load frame from webpage of safari, we will invoke the delegate methods of webkit informal protocol(WebFrameLoadDelegate): webView:didStartProvisionalLoadForFrame: webView:...