Search code examples
javascripthtmlasp.net-coretinymce

Error javascript in TinyMce editor? How about saving data using Name?


I'm using tinyMce editor in my .Net Core project, but the scriptt function of the editor has an id.

<script>
        tinymce.init({
            selector: 'textarea#default'
        });
    </script>

In javascript I already had an id defined for the textarea

        'Desc': $('#p_Ack').val(),//this is how i was adding before the editor was added
        'Desc': $('textarea[name="p_Ack"]').val(),

I tried to save by giving a name but still the text in the textarea is blank. What can I do?

 <textarea  id="default" name="p_Ack"></textarea> 


Solution

  • If you want to get the content in TinyMCE.You can try to use:

    'Desc':tinymce.get("default").getContent(),
    

    or

    'Desc':tinymce.activeEditor.getContent(),