Approval_notes__c is a formula field that contains html tags.

I display it in a Lightning web component, the lightning-formatted-rich-text component work perfectly and display the text correctly. I want to display the text also as help note in the title attribute. Is there a way to remove html tags from it without using JavaScript?

<lightning-formatted-rich-text title={Approval_notes__c} class="slds-truncate" value={Approval_notes__c}></lightning-formatted-rich-text>

enter image description here


you can set title attribute separetely for lightning-formatted-rich-text tag




get preparedTitle(){
    //prepare desired title without special symbols
    return this.Approval_notes__c.replace(.....//correct regex goes here)
  • Thanks for you answer, I am trying to do that without Js
    – Raphael D
    May 12 '21 at 11:03
  • 1
    unfortunately, it is not possible for now to do just by means of markup, as lwc markup do not have any markup expressions (but aura has) It will require an additional step to prepare the sanitized string for the title (in apex, or in js) May 12 '21 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.