【发布时间】:2012-05-04 08:17:23
【问题描述】:
我正在使用 Codemirror 的 textarea 插件,但我无法检索 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 中显示什么?
标签: javascript codemirror