How to get the current value of an FCKEditor textarea via javascript
javascriptgetElementID will not work with FCKEditor, so after some searching and hacking, I figured it out.
You SHOULD have some javascript code to initialize the editor that looks something like this:
<script type="text/javascript"> <!-- var oFCKeditor = new FCKeditor( 'answer' ) ; oFCKeditor.BasePath = 'js/fckeditor/' ; oFCKeditor.Height = 300 ; oFCKeditor.Width = 500 ; oFCKeditor.ReplaceTextarea() ; oFCKeditor.EnableOpera = true; oFCKeditor.EnableSafari = true; //--> </script>
In order to get the current value of whatever is in your editor, all you need to do is this:
var answerText = FCKeditorAPI.GetInstance('answer')
showmethetext = answerText.GetHTML();
Tada, showmethetext will work!



Loading....