Babr Babr -4 years ago 73
Javascript Question

How to cut string after certain HTML tag?

I want to to cut text after

</b>
tag.

So for example,

<div class="quote"><b> Quote from: Bob </b>
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.</div>


Should be truncated to

<div class="quote"><b> Quote from: Bob </b>


How can I archive this?

Here is what I came up with:

https://jsfiddle.net/Babr/2q4940h1/8/

Answer Source

For your case you may do:

$(".quote").html($(".quote").children());

Would be truncated to:

<div class="quote"><b> Quote from: Bob </b>

FIDDLE

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download