ckeditor - This code is not run, getelementbyid return null -


this code not run, getelementbyid return null

<script type='text/javascript'>       ckeditor.on('instancecreated', function (e) {          document.getelementbyid(e.editor.name + '_preview').innerhtml = e.editor.getdata();          var = $('#' + e.editor.name + '_preview').height();          $('#' + e.editor.name + '_txt').val(a.tostring());          e.editor.on                       ('change'                       , function (ev) {                           document.getelementbyid(e.editor.name + '_preview').innerhtml = ev.editor.getdata();                           var = $('#' + e.editor.name + '_preview').height();                           $('#' + e.editor.name + '_txt').val(a.tostring());                       }                       );      });      var config = { extraplugins: 'onchange' };      ckeditor.replace('contents', config); </script> 

edit: code should understandable now.

please see link instancecreated. although instance created, hasn't been initialized yet. if want work editor, please use instanceready event.

please make sure element id e.editor.name + '_preview' exists because reason problem may such id doesn’t exist.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -