freelance phinix
freelance phinix

Reputation: 68

Tinymce editor is not displaying in some textareas

I have a certain code to display some textarea according to the number of days choosed, i need all these text areas as editor .I have given then class tinyMCE but its not working

Its working if i use html code directly .Im using jquery html() to display contents and while using this the editor is not showing

division +='<div class="form-group">Activity on '
           +btwn[i].getDate()+' '+month+
           '<div id="activity_div"><input type="hidden" name="hidden_date[]" value="'+btwn[i].getDate()+
           '"/><input type="hidden" name="hidden_day[]" value="'+month+
           '"/><label for="input-demo-a-1">Activity name</label><input type="text" id="test-text'+i+
           '" name="activity_name[]" style="width:99.5%;"/></br><label for="input-demo-a-1">Activity detail</label><textarea id="test2-text'+i+
           '" class="tinyMCE " name="activity_detail[]" style="width:99.5%;"></textarea></br><button  class="btn btn-success actvty" id="actvty-btn" data-toggle="modal" data-target="#long-modal'+i+
           '" rel="'+i+'">Load Activities<input type="hidden" name="n_days" value="'+d+
           '"/></div></div>'

division is the content I'm using and display it using $("#my_testing").html(division);

The editor is not showing while using this method , please help me

Upvotes: 1

Views: 2095

Answers (1)

Niki van Stein
Niki van Stein

Reputation: 10744

After adding the textarea dynamically you need to re-init the tinymce so it will apply to the new textareas:

tinymce.init({selector:'.tinyMCE'});

Upvotes: 1

Related Questions