Blog

How to reset FreeTextBox editor using javascript

By Purushottam Rathore Mar 15 2013
How to reset FreeTextBox editor using javascript.
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 5.8k
  • 0

This is third party open source FreeTextbox (FTB) editor. With the help of this blog you can reset the freetextbox editor using javascript. This is very simple but tricky code.

<FTB:FreeTextBox ID="FreeTextBox1" BreakMode="LineBreak" DesignModeCss="~/FreeTextBox/DesignMode.css" Width="780px" Height="210px" ToolbarLayout="FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker,SymbolsMenu|Cut,Copy,Paste,Delete|Bold,Italic,Underline,Strikethrough,Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImageFromGallery|InsertRule,InsertDate,InsertTime,InsertTable,InsertDiv,EditStyle,Preview,SelectAll,WordClean,NetSpell" runat="Server" Focus="False" TabIndex="0" SupportFolder="~/FreeTextBox/" AutoParseStyles="False" FormatHtmlTagsToXhtml="False" HtmlModeDefaultsToMonoSpaceFont="True" ClientIDMode="Static"></FTB:FreeTextBox>

<input type="button" value="Reset" id="buttonReset" runat="server" clientidmode="Static" />

<script language="javascript">

$("#buttonReset").bind('click', function () {
            
if (FTB_API != null) {
                objFTBControl = FTB_API[
'FreeTextBox1'];
                
if (objFTBControl) {
                    objFTBControl.SetHtml(
"");
                }
            }     
});

</script>