I have a javascript string with HTML code. I show it and I have connected a read / less toggler based on the number of words. The problem is that when I compress the HTML, it may have open tags, suppose that
<p>A computer is a general purpose device that can be <b>programmed</b> to carry out a finite set of arithmetic or logical operations</p>
when compressed, it becomes
<p>A computer is a general purpose device that can be <b>programmed...more</p>
Due to an open bold tag, the following data becomes bold.
I want a javascript solution to close open tags in a string. Any help is much appreciated. Thanks to everyone in advance.
source share