0

I am Querying Rich text area field using sforce connection in vf. I am getting the result in html format. I need only the text with the applied css format.

how to achieve this.

SOQL Result:

<i><b>france</b></i>

Required Result in Java Script: france

Please help me to resolve this issue.

0

Try this one where you can get inner value of the text:

var content = "<p>Dear sms,</p><p>This is a test notification for push message from center II.</p>";

var text = $(content).text();
1

You can strip the html for rich Text field using stripHtmlTags(htmlInput) Or you can apply regular expression to remove html tags.

for e.g String target = someString.replaceAll("<[^>]*>", "");

javascript :- var target = str.replace(/<[^>]*>/g, '');

  • Yes, I can strip the characters and convert to plain text. But i need the styles should be applied to the text for eg; (bold,italic) to text france. – Sandra Feb 8 '16 at 8:41
  • Can you explain your use case? – SFIntegrator Feb 8 '16 at 11:42
  • when i query rich text area field its returning content wrapped with html tags. I need the content only with applied html formatting. – Sandra Feb 8 '16 at 11:50

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.