CKEditor events WTF
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.2/ckeditor.js"></script>
<select id="moo">
<option value="x">change me!</option>
<option value="y">to something else!</option>
</select>
<button id="d1">Destroy1</button>
<button id="d2">Destroy2</button>
<button id="i1">Init1</button>
<button id="i2">Init2</button>
<textarea id="editor1">Hello1!</textarea>
<textarea id="editor2">Hello2!</textarea>
JavaScript
function init1() {
CKEDITOR.replace( 'editor1', {
plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar'
} );
}
function init2() {
CKEDITOR.replace( 'editor2', {
plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar'
} );
}
CKEDITOR.document.getById( 'moo' ).on( 'change', function() {
console.log( 'select changed!' );
} );
document.getElementById( 'moo' ).onchange = function() {
console.log( 'changing natively...' );
};
document.getElementById( 'd1' ).onclick = function() {
CKEDITOR.instances.editor1.destroy();
};
document.getElementById( 'd2' ).onclick = function() {
CKEDITOR.instances.editor2.destroy();
};
document.getElementById( 'i1' ).onclick = init1;
document.getElementById( 'i2' ).onclick = init2;
init1();
init2();