This might be really very simple, I have a list view with multiple Rich Text fields, I want to remove HTML formatting from those field in a specific view and return them as Plain text.

I would like to do it without using RegEx. I am sure there must be any simple ways. Any suggestions?

  • Is this considered a duplicate? Similar questions can be found on stack overflow, since the underlying question here is how to strip HTML formatting from text. – wjervis May 15 '14 at 16:31

It was simpler then i thought. Implemented JSLink for the same...

(function () {

// Create object that have the context information about the field that we want to change it output render 
var viewContext = {};
viewContext.Templates = {};

viewContext.Templates.Fields = {
    "Field":{"View": renderPlainText}       


My render function looks like below:-

function renderPlainText(ctx) {
var value = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
value = value.replace(/<(?:.|\n)*?>/gm, '');
return "<div>" + value + "</div>"; }
  • Your function uses regular expressions, which you said you did not want. – yandr May 16 '14 at 6:35
  • sorry for the confusion, all the other ways i found was implemented using SharePoint object model where we SPListItem class had a method for returning the value as plain text, thought of going ahead with whatever i can find fast :) – Sudhir Kesharwani May 16 '14 at 14:39

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.