E
E
Evgeny Kylin2016-05-09 10:27:31
TinyMCE
Evgeny Kylin, 2016-05-09 10:27:31

How to re-initialize tinymce on ajax load?

Loading the following code

function input_content(){
  tinymce.init({
    selector: "textarea.input_content",
    	language: 'ru_RU',
    	skin: 'alko',
    	height : 300
  });
}

Then the form with this code is loaded using AJAX
<div class="form-group">
  <label>Описание</label>
  <textarea name="content" class="form-control input_content"></textarea>
</div>
<script>
  input_content();
</script>

The first time tinymce is initialized normally, it does not want to reload.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
KCT, 2016-06-13
@KCT


add id="content" to the form
tinyMCE.get('content').setContent($value);

M
MIK Ek, 2017-05-10
@MIKEk8

Before re-initializing, do
tinyMCE.remove();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question