我正在使用Codemirror的textarea插件,但我无法检索textarea的值。如何获取Codemirror textarea的值
代码:
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-csrc"
});
function showCode()
{
var text = editor.mirror.getCode();
alert(text);
}
它显示错误:
editor.getCode() is not a function.
'console.dir(editor.morror)'和'console.dir(editor)'在chrome中显示的是什么? – sissonb 2012-04-23 17:56:49