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
getContent() method. to add the TinyMCE script and text area, then we can get the value when the editor is initialized by writing: tinymce. init({ selector: '#mytextarea', setup(editor) { editor.
You don't need to use tinymce as a jQuery plugin but the option is there if you would like to. The vast majority of the tinymce source code is in the tinymce. min. js file and the jQuery.
I think you can do:
$(function() { $("#lang").change(function() { var s = $(this).val(); alert(s); tinyMCE.activeEditor.setContent(s); }); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With