Skip to main content

How to fetch value from Rich Text editor using jquery

When we use multi-line text in SharePoint List, Rich Text Editor will be rendered on List forms. If you ever need to apply a custom validation on this control, you would need to fetch values programmatically.

So how can we fetch value from a rich text editor.

As a first step, open the List form using SharePoint Designer. Replace the control ID (eg., ff1) with a custom name. Let us say Desc.

Every rich text editor is basically a "contenteditable" DIV. We cannot use ID completely. So we need to use wildcard and also use role attribute which is always "textbox" for rich text editor.

So your jQuery code looks like this:

$("[role=textbox][id*='Desc']").html();

By using role attribute and the field name, you are assured of getting the value of a multi-line text field.

Comments

Post a Comment