Reputation: 83
When I try to load tinymce editor without any div-blocks it works good even when I launch my fucntion a few times by a click. When I add editor into div-block it works only one time. What I have to change to force editor to work right?
I add 2 global variables in javascript which I generate from PHP. These two variables are written in one line, for comfort I wrote them in column. Unfortunately this code doesn't work here cause it cannot load library tiny.
JS
<script>
var a = "<textarea id='comments'></textarea><script>
tinymce.init({
selector: 'textarea#comments',
language : 'en',
width : '100%',
height : 220,
plugins: ['link image paste dlebutton'],
theme: 'modern',
relative_urls : false,
convert_urls : false,
remove_script_host : false,
extended_valid_elements : 'div[align|class|style|id|title]',
paste_as_text: true,
toolbar_items_size: 'small',
statusbar : false });<\/script>";
var b = "<div id='subload'></div>";
</script>
Html code
<div id="click">Click</div>
<div id="load"></div>
Jq
$('#click').click(function() {
$('#load').html(b);
$('#subload').html(a); });
Upvotes: 1
Views: 499
Reputation: 83
Oh, okay, I've found an answer. I can just reload tiny like this:
tinymce.remove();
tinymce.init({selector: 'textarea'});
Upvotes: 1