I am trying to grab the value entered into the textarea, but it seems to not be working. I tried it again with instead of and it seems to be working just fine.
Edit: just realized that this has something to do with tinyMCE. Tried it without tinyMCE and it works fine. Any idea why this is?
$('.answers').load(url, function() {
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "fullpage",
theme_advanced_buttons3_add : "fullpage"
});
$('#submitAnswer').on('click', function(e){
var dataString = $("#addAnswer").val();
alert(dataString);
e.preventDefault();
});
})
Doesn’t work with:
<textarea id="addAnswer" name="addAnswer"></textarea>
Works with:
<input id="addAnswer" name="addAnswer"></input>
It’s not a textarea any more, so the value property won’t work.
This is how you get a reference to the editor, and the text from it:
var text = tinyMCE.get(‘myeditorid’).getContent();
JavaScript to find TinyMCE rich text editor value is null or not