Search code examples
javascriptjqueryaloha-editor

How to remove Aloha Editor from DOM?


I am using Aloha to edit contents on a client's website and want to remove all extra DOM elements and attributes when I save.

A paragraph tag goes from:

<p></p>

to:

<p id="79a2eed4-1d7d-55a9-1c44-d384d35edf4f" 
    class="aloha-editable aloha-editable-active" 
    contenteditable="true" style=""></p>

I want to remove all of those added elements. Is there a destroy call in the Aloha API that I have missed?


Solution

  • The following reverts an editable to its non-editable form

    $('#editable').mahalo();
    

    This should also remove the attributes added by aloha (classes, contenteditable=true, etc.).

    I have added it to the official documentation.