- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 12:11 AM
I have a string in html field such as the following:
<p><strong>Impact </strong><br /><strong>Test1 : </strong> abcde</p>
I want to remove all html tag and still keep the format in field (just only spacebar & new line (Enter))
Example Result i want :
Impact
Test1 : abcde
my code :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:27 AM - edited 04-04-2024 10:30 AM
@Yongyood Singta : New Line - "\n"
Did you try to replace it as, var str = myStr.getHTMLValue().replace(/<\/?[^>]+(>|$)/g, "\n");
Note: Might require some adjustments on the regex format.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:27 AM - edited 04-04-2024 10:30 AM
@Yongyood Singta : New Line - "\n"
Did you try to replace it as, var str = myStr.getHTMLValue().replace(/<\/?[^>]+(>|$)/g, "\n");
Note: Might require some adjustments on the regex format.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 07:41 PM
It work !! Thank you so much.