Skip to content Skip to sidebar Skip to footer

Remove Onsubmit Event Hook From Tinymce

I'm currently working on a page where a user has the ability to edit some HTML. To enable him to do it in a nice way, I'm using TinyMCE, as it has a rather nice interface. The prob

Solution 1:

The actual solution seems to be rather easy. As you can see in the init for TinyMCE there is already an event for change that an action is bound to. For now it seems to work to bind to the submit event and just return false.

tinymce.init({
    selector: 'textarea',
    setup: function(editor){
        // Let the editor save every change to the textarea
        editor.on('change', function(){
            tinymce.triggerSave();
        });

        // Do nothing when submitting the form
        editor.on('submit', function(){
            return false;
        });
    }
});

Post a Comment for "Remove Onsubmit Event Hook From Tinymce"