使用Jquery在特定标记后插入
标记

问题描述:

I am toying around with WHMCS billing software.

http://www.whmcs.com/

I have a page called cart.php which gives a list of all the features of a product that the customer has selected.

    <div class="highlightbox">
<h2>Anonymous VPN - Anonymous VPN - Knight</h2>
<p>As Low as<strong> $8.33/month</strong>
<strong>Best Plan for Heavy Users</strong>
Random IP Address-------------------<strong>YES!</strong>
Ever Changing IP Address-----------<strong>YES!</strong>
US IP Address--------------------------<strong>YES!</strong>
Logging the Sites you Visit.--------<strong>NEVER!</strong>
Super Secure Privacy-----------------<strong>YES!</strong>
Great for P2P---------------------------<strong>YES!</strong>
Super High Speed---------------------<strong>YES!</strong>
Great for Streaming-------------------<strong>YES!</strong>
US Video Services --------------------<strong>YES!</strong>
Runs on Windows -------------------<strong>YES!</strong>
Runs on Mac---------------------------<strong>YES!</strong>
Runs on IOS --------------------------<strong>YES!</strong>
No Overage Charges-----------------<strong>YES!</strong>
Host Servers-----------------------------<strong>No</strong>
<em>Use our Static IP service for hosting servers</em><br/>
<strong>Unlimited Bandwidth-------------------YES!</strong>
.</p></div>

The issue im running into is that some of these are on one line, which makes it hard to read. I want to insert a <br /> tag after each </strong> tag.

I can't do it through manually changing the PHP file. So I need to use jquery. Can you use jquery to insert a break tag after each closing strong tag?

You can see it in action here http://jsfiddle.net/acdpy0co/

我正在使用WHMCS计费软件。 p>

http://www.whmcs.com/ p >

我有一个名为cart.php的页面,其中列出了客户选择的产品的所有功能。 p>

 &lt; div class =“highlightbox”&gt; 
&lt; h2&gt;匿名VPN  - 匿名VPN  -  Knight&lt; / h2&gt; 
&lt; p&gt;低至&lt; strong&gt;  ;  $ 8.33 /月&lt; / strong&gt; 
&lt; strong&gt;重度用户的最佳方案&lt; / strong&gt; 
Random IP地址-------------------&lt; strong&gt; YES!  &lt; / strong&gt; 
更改IP地址-----------&lt; strong&gt; YES!&lt; / strong&gt; 
 
 
 
 
 
NUS IP地址--------------  ------------&lt; strong&gt; YES!&lt; / strong&gt; 
记录您访问的网站.--------&lt; strong&gt;从不!&lt; / strong&gt; \  nSuper安全隐私-----------------&lt; strong&gt; YES!&lt; / strong&gt; 
Great for P2P ---------------  ------------&lt; strong&gt; YES!&lt; / strong&gt; 
超高速---------------------&lt;  strong&gt; YES!&lt; / strong&gt; 
Great for Streaming -------------------&lt; strong&gt; YES!&lt; / strong&gt; 
 
 
 
 
 
视频服务---  -----------------&lt; strong&gt; YES!&lt; / strong&gt; 
Runs在Windows上------------------  - &lt; strong&gt;是!&lt; / strong&gt; 
 
在Mac上运行---------------------------&lt; strong&gt; YES!&lt;  ; / strong&gt; 
在IOS上运行--------------------------&lt; strong&gt; YES!&lt; / strong&gt; 
No Overage Charges-  ----------------&LT;强&克 t;是!&lt; / strong&gt; 
主机服务器-----------------------------&lt; strong&gt; No&lt; / strong&gt;  
&lt; em&gt;使用我们的静态IP服务托管服务器&lt; / em&gt;&lt; br /&gt; 
&lt; strong&gt;无限带宽------------------- YES  !&lt; / strong&gt; 
。&lt; / p&gt;&lt; / div&gt; 
  code>  pre> 
 
 

我遇到的问题是其中一些是在一条线上 ,这使得它很难阅读。 我想在每个&lt; / strong&gt; code>标记后插入&lt; br /&gt; code>标记。 p>

我无法通过手动更改PHP文件来实现。 所以我需要使用jquery。 你可以使用jquery在每个结束强标签后插入一个break标签吗? p>

你可以在这里看到它的运作 http://jsfiddle.net/acdpy0co/ p> div>

You can use after():

$('strong').after('<br />');

Updated fiddle