Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  117] [ 7]  / answers: 1 / hits: 51709  / 13 Years ago, tue, december 20, 2011, 12:00:00

Hi I need to set predefined content inside the tinyMCE Editor. Below is my html and jquery.



<script type=text/javascript>
tinyMCE.init( {
mode : exact ,
elements : country
});
</script>
<script type=text/javascript>
$(function() {
$(#lang).change(function() {
var s = $(this).val(); alert(s);
$(#country).val(s);
})
})
</script>


<select id=lang>
<option value=>Please Select country</option>
<option value=us>US</option>
<option value=es>SPAIN</option>
<option value=jp>JAPAN</option>
</select><br /><br />
<textarea id=country cols=10 rows=5></textarea>


The script works for a normal textarea but not for tinyMCE. Is there anything I am doing wrong in this.



Thanks


More From » jquery

 Answers
39

I think you can do:



$(function() {
$(#lang).change(function() {
var s = $(this).val();
alert(s);
tinyMCE.activeEditor.setContent(s);
});
});

[#88468] Monday, December 19, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hallie

Total Points: 503
Total Questions: 114
Total Answers: 103

Location: Iraq
Member since Fri, Jun 5, 2020
4 Years ago
;