douji8549 2014-12-02 13:30
浏览 344
已采纳

使用Jquery在特定标记后插入<br />标记

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/

  • 写回答

1条回答 默认 最新

  • doukengsha9472 2014-12-02 13:31
    关注

    You can use after():

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

    Updated fiddle

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口