I'm using this jquery plugin to create a wysiwyg text editor,
I created a textarea where I want to display the text editor:
<textarea class="editor" rows="3" name="textEditor" id="textEditor"></textarea>
and then I called the jquery function:
<script type="text/javascript">
$(document).ready( function() {
$("#textEditor").Editor();
});
</script>
Until now everything is working good, but when I wanted to know if the text is writed correctly or not by using this function:
function displayText(){
alert($("#textEditor").val());
}
it gives me an empty text!
What am I missing ?
From the documentation of that plugin on Github, you need to use the getText
option to retrieve the value of the editor. Try this:
function displayText(){
alert($("#textEditor").Editor("getText"));
}
Right!!!
There two methods to get and set text.
$("#TextEditorID").Editor("setText", "TextInput"));
$("#TextEditorID").Editor("getText));
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