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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -