Skip to content

Synchronize the change of a contenteditable to a target like a textarea

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

LeResKP/jquery.contenteditablesync

Repository files navigation

Contenteditablesync

Use this plugin to synchronize the contenteditable's text content to a target like a textarea.

Getting Started

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.

Options

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();}
}

About

Synchronize the change of a contenteditable to a target like a textarea

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published