2

I have a problem with TinyMCE 4 - I can't get HTML content from textarea. I am using the following code:

<textarea  id="tiny">some text</textarea>
    <a id="click" href="#">click</a>
    <script>
       $(document).ready(function () {
           $("#click").click(function(e){
               e.preventDefault();
               var content=tinymce.get('content id').getContent();
               console.log(content);
           });
       });
    </script>

And as a result I'm getting this:

enter image description here

Question is how to get HTML content from <textarea>?

1 Answer 1

1

the id of the textarea is "tiny" not "content id"...

<textarea id="tiny">some text</textarea>

try changing...

var content=tinymce.get('content id').getContent();

to...

var content=tinymce.get('tiny').getContent();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.