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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -