Use this plugin to synchronize the contenteditable's text content to a target like a textarea.
Download the production version or the development version.
In the header of the web page:
<script src="jquery.js"></script> <script src="dist/contenteditablesync.min.js"></script> <script> jQuery(function($) { $('div[contenteditable]').contenteditablesync(); }); </script>
Example of body of the web page:
<textarea id="textarea1"></textarea> <div contenteditable="true" data-target="#textarea1"></div>
NOTE: If no data-target defined the plugin will synchronise with the previous element.
interval: (default: 2000ms) The interval time in milliseconds between the checks of the content's change. getContent: function to get the content of the contenteditable. It's usefull if you want to make some updates before synchronizing it.
The default options:
{ interval: 2000, getContent: function($contenteditable) {return $contenteditable.text();} }