onTheInternet
onTheInternet

Reputation: 7253

Using Jquery to insert <br /> tag after specific tag

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/

Upvotes: 0

Views: 75

Answers (1)

Rory McCrossan
Rory McCrossan

Reputation: 337570

You can use after():

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

Updated fiddle

Upvotes: 3

Related Questions