You need to sign in to do that
Don't have an account?
![Vijaya Kumar Reganti Vijaya Kumar Reganti](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
How to remove the HTML tags that are displaying in the text
Hi All,
I have a code to send the email.Upon sending the email,I am creating an activity with that mail.
But when I am saving the body of the email into Description field of the Activity, all the HTML tags are appearing.
Like if there are multiple lines present in the body of the mail, then it displays multiple <br></br> tags for each line.
Please help me resolve this issue.
Thanks,
vijay
Hi Friends,
Finally I got my own solution for this.
I have done it using the following method to eleminate the HTML tags from the rich text area field.
replaceAll('<[/a-zAZ0-9]*>',' ');
replaceAll(' ',' ');
Thanks,
Vijay
All Answers
Have you tried the String.stripHtmlTags() method?
Can u please explain how to use this in my case
TT.Description = '<img src="'+SchoolPortalEmails.Header_Graphic_Link__c+'"/>\r\n<p>'+SchoolPortalEmails.Body_Of_Email__c+'<p>';
in the above case only I am getting the problem.
Thanks,
vijay
TT.Description = TT.Description.stripHtmlTags();
Hi Friends,
Finally I got my own solution for this.
I have done it using the following method to eleminate the HTML tags from the rich text area field.
replaceAll('<[/a-zAZ0-9]*>',' ');
replaceAll(' ',' ');
Thanks,
Vijay
<td><p>{!Var.Field__c}</p></td>
Expected Output : FieldValue
Actual Output : <p>FieldValue</p>
How to trim the HTML tags (i.e. <p></p>) from output ?
Use this to remove HTML tags from rich text area field in JavaScript:
const strippedString = htmlString.replace(/(<([^>]+)>)/gi, "");
console.log(strippedString);