- Getting Started
- Browser Support
- Languages Support
- Shortcuts
- Activation
- Examples
- Customize the Editor
- Use-cases
- Plugins
- APIs
- Development Frameworks
- Server Integrations
- Server SDKs
- Migration Guides
- Changelog
- Tutorials
API
Destroy / Init editor
Try it yourself:
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>
var editor = new FroalaEditor('div#froala-editor')
// Destroy action.
document.querySelector('a#btn-destroy').addEventListener('click', function (e) {
e.preventDefault();
if (editor) {
editor.destroy()
}
});
// Initialize action.
document.querySelector('a#btn-init').addEventListener('click', function (e) {
e.preventDefault();
if (!editor) {
editor = new FroalaEditor('div#froala-editor')
}
})
</script>