Reputation: 31
I am trying to get a the value of a textbox that is using tinyMCE (jQuery Version) but when i do i get no content from the textbox. See my code below;
var content = $( "#content_textarea" ).val();
alert(content);
Also i am not using a form and the code is activated using a button.
I have also tried this code;
var content = tinyMCE.get('content_textarea').getContent();
alert(content);
What am i doing wrong?
Upvotes: 2
Views: 6670
Reputation: 41
Try:
var editor='content_textarea';
var content =tinyMCE.activeEditor.getContent();
alert(content);
Or if you don't like that, you can do:
tinyMCE.triggerSave();
var content =$('#content_textarea').val();
alert(content);
Both work for me.
Upvotes: 4
Reputation: 9781
Based on the documentation here:
http://www.tinymce.com/wiki.php/jQuery_Plugin
You should use:
// Gets the contents from a specific editor
alert($('#someeditor').html());
Upvotes: 0
Reputation: 9165
ive had the same problem with ckeditor... mybe this is of interest.
CKEDITOR.instances['editor1'].getData();
helped me out....whereby editor1 is the name of the instance
Upvotes: -1