I m trying without success to convert a textarea that i have created dynamically into CKEditor in Yii2. I m using the yii2-ckeditor-widget from 2amigos.
Here is how I generate the Textarea in a form:
$form->field($model, 'answer')
->textarea(['rows' => 5, 'id' => 'textarea_answer'])
->label(false)
The generated textarea is:
<textarea id="textarea_answer" class="form-control" name="topic[answer]" rows="5">
<p>test</p>
</textarea>
Then when I add the Textarea dynamically in a div, it works. But directly after that i try to convert the Textarea to CKEditor with:
CKEDITOR.replace('textarea_answer');
or
$( '#textarea_answer' ).ckeditor();
The textarea get the Style property visibility:hidden and disappear. Like below:
<textarea id="textarea_answer" class="form-control" name="topic[answer]"
rows="5" style="visibility: hidden;">
<p>test</p>
</textarea>
And i get the following error in the console:
Uncaught TypeError: Cannot read property 'registered' of undefined
How can i solve that? Is it may be a dependencies problem?