Search code examples
javascriptjqueryasp.nettinymce

Reset TinyMCE box


I am using TinyMCE editor. I want to clear the content inside the editor box with some button click present on my form.

Can you let me know how to do so?


Solution

  • This can be easily done (no need to use the slow jQuery tinymce build) using the following code as onclick-action of your button:

    // 'content' is tinymce default,
    // but if your textarea got an ID that is the one you need!
    var my_editor_id = 'content';
    
    // set the content empty
    tinymce.get(my_editor_id).setContent('');