Working with TinyMCE to enable editor to toggle off html mode, what I'm struggling with is converting list items into asterisks:
<ul>
<li>Bullet 1</li>
<li>Bullet 2</li>
<li>Bullet 3</li>
</ul>
Should become
* Bullet 1
* Bullet 2
* Bullet 3
I've used a similar regex to convert paragraphs to "\n$1\n\n" and that is working, but I can't seem to get the regex to work for list items, here's my code:
At both alerts, the content remains the same:Code:// replace p tags with line breaks strippedValue = strippedValue.replace(/<p>([^<\/p>]*)<\/p>/ig, "\n\n$1\n\n"); alert(strippedValue); // replace list items with astrisks strippedValue = strippedValue.replace(/<li>([^<\/li>]*)<\/li>/ig, "* $1\n"); alert(strippedValue);
<ul><li>Bullet 1</li><li>Bullet 2</li><li>Bullet 3
</li></ul>




Bookmarks