lundi 30 octobre 2017

How to get value of CKEditor 5?

I want to be able to return the value of the CKeditor textarea, and also write my text inside it .. i used CKEDITOR 5 CDN, Fisrt this my code for the textarea it works fine

<script src="http://ift.tt/2zhLmhH"></script>

<textarea class="inputStyle" id="editor" name="content" placeholder="Write your email.."></textarea>
<script>ClassicEditor.create(document.querySelector('#editor')).catch( error => { console.error( error );  } ); </script>

I used to get the data from the textarea before the CKeditor by:

var text = $('textarea#editor').val();

and set the data by:

$('textarea#editor').html("");

but i'm lost now? i tried many ways .. what is the correct way?




Aucun commentaire:

Enregistrer un commentaire