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 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line