When submitting a form with Ajax, the content of the kindeditor is not available, and the HTML data cannot be retrieved
Cause: When Ajax commits, Kindedito's HTML data is not synced to the form, so how do you get the HTML data?
---------------------------------------------------
Kindeditor 4.x Documentation: Get HTML data
Get HTML content
html = editor.html ();
The value of textarea can be obtained directly after synchronizing the data
Editor.sync ();
html = document.getElementById (' editor_id '). Value; Native API
html = K (' #editor_id '). Val (); Kindeditor Node API
html = $ (' #editor_id '). Val (); Jquery
Set HTML content
editor.html (' HTML content ');
----------------------------------------------------
From this we can see that when Ajax submits the form, the value of textarea is empty, and Sync () is used to synchronize the HTML data
So when to sync, how to sync? Kindeditor also provides a method:
Afterblur
The callback function that is executed when the editor loses focus (Blur).
Data type: Function
Default value: None
Final Answers and Solutions:
<script type= "Text/javascript" > kindeditor.ready (function (K) { = K.create (' #AContent ', { functionthis. sync ();} ); }); </script>