JSFiddle - React, Tailwind, and code Playground

by ruslyrossi

HTML

<script src="http://ckeditor.com/apps/ckeditor/4.3/ckeditor.js?mxj8dy"></script>
<form action="sample_posteddata.php" method="post">
    <p>
        <label for="editor1">
            Editor 1:
        </label>
        <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="2">
        </textarea>
    </p>
    
    <p>
        <label for="editor2">
            Editor 2:
        </label>
        <textarea class="ckeditor" cols="80" id="editor2" name="editor2" rows="2">
        </textarea>
    </p>
    
    <button id="setAll">Set All</button>

</form>

JavaScript

$( document ).ready(function() {
	$('#setAll').click(function() {
        
        for (var i in CKEDITOR.instances) {
			CKEDITOR.instances[i].on('change', function() {
				console.log('detected')
			});
			console.log(i);
		}
        
		var value = CKEDITOR.instances['editor1'].getData() // get value
		
		console.log(value);
		
		CKEDITOR.instances['editor2'].setData(value) // paste value
		
		return false;
	});
});