Days
Hours
Minutes
Seconds
x

New Froala Editor v4.3.1 is here – Learn More

Skip to content

API

Destroy / Init editor

destroy-init

Try it yourself:

The buttons below will destroy and init the rich text editor again.


Destroy Init


Edit in JSFiddle

HTML

<div id="froala-editor">
  <p>The buttons below will destroy and init the rich text editor again.</p>
</div>
<p>
  <a id="btn-destroy" href="#" class="btn r-btn highlight text-small">Destroy</a>
  <a id="btn-init" href="#" class="btn r-btn text-small">Init</a>
</p>

JAVASCRIPT

<script>
  $(function() {
    $('div#froala-editor').froalaEditor({
    })
  });

  // Destroy action.
  $('a#btn-destroy').on('click', function (e) {
    e.preventDefault();

    if ($('div#froala-editor').data('froala.editor')) {
      $('div#froala-editor').froalaEditor('destroy');
    }
  });

  // Initialize action.
  $('a#btn-init').on('click', function (e) {
    e.preventDefault();

    if (!$('div#froala-editor').data('froala.editor')) {
      $('div#froala-editor').froalaEditor();
    }
  });
</script>