Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content

Examples

External Button

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


Clear

HTML

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

JAVASCRIPT

<script>
  $(function() {
    $('div#eg-external-button').editable({
      inlineMode: false
    })

    $('a#get-text')
      .on('mousedown', function (e) {
        if (e.which !== 1) return true;

        e.preventDefault()
        e.stopPropagation()
      })
      .on('click', function (e) {
        e.preventDefault()
        e.stopPropagation()
      })
      .on('mouseup', function (e) {
      if (e.which !== 1) return true;

      e.stopPropagation();
      e.preventDefault();

      $('div#eg-external-button').editable('setHTML', '');
    })
  });
</script>
Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.