How to make certain section of the text area in the RTE as editable and remaining as non-editable
Solution
Render the RTE control, and its content has two div sections. Consider that, the first ‘div’ is editable and second ‘div’ non editable.
Set the ID for the first “div” element as “editable” and the second “div” element as “non-editable”. Refer the following code
C#
<ej:RTE ID="ToolsSample" Width="850" ClientSideOnCreate="onCreate" Height="440" ShowFooter="true" runat="server" EnableRTL="false" Locale="en-US"> <RTEContent> <div id="editable"> Description: The Rich Text Editor (RTE) control is an easy to render in client side. Customer easy to edit the contents and get the HTML content for the displayed content. A rich text editor control provides users with a toolbar that helps them to apply rich text formats to the text entered in the text area. </div> <div id="noneditable"> Functional Specifications/Requirements: Provide the tool bar support, it’s also customizable. Options to get the HTML elements with styles. Support to insert image from a defined path. Footer elements and styles(tag / Element information , Action button (Upload, Cancel)) </div> </RTEContent> </ej:RTE>
In the client side event name called “create”, set the attribute of “contenteditable” as false to the “noneditable” div element.
Javascript
<script> function onCreate(args) { $(this._getDocument().body).find("#noneditable").attr("contenteditable", false); } </script> |