Buttons

External Button

This example illustrates how to clear the text using a button external to the Froala WYSIWYG HTML Editor interface.

Clear


Edit in JSFiddle

HTML

<div id="froala-editor">
  <p>This example illustrates how to clear the text using a button external to the Froala WYSIWYG HTML Editor interface.</p>
</div>
<p><a id="get-text" class="btn r-btn highlight text-small">Clear</a></p>

JAVASCRIPT

<script>
  $(function() {
    $('div#froala-editor')
      .on('froalaEditor.initialized', function (e, editor) {
        editor.events.bindClick($('body'), 'a#get-text', function () {
          editor.html.set('');
          editor.events.focus();
        });
      })
      .froalaEditor()
  });
</script>