Bah*_*Gul 1 javascript textarea codemirror
我创建了一个textarea来使用CodeMirror突出显示C#代码的文本.但是当我试图获得textarea的价值时,我失败了.
我正在创建我的编辑器
var editor = CodeMirror.fromTextArea(document.getElementById("txtCode"), {
lineNumbers: true,
mode: "text/x-csharp",
matchBrackets: true
});
Run Code Online (Sandbox Code Playgroud)
当我写一些毫无意义的词并尝试获得这样的价值时:
alert(document.getElementById("txtCode").value);
Run Code Online (Sandbox Code Playgroud)
它返回:
if(true){}else{}
Run Code Online (Sandbox Code Playgroud)
当我试图让它像:
alert(document.getElementById("txtCode").getValue());
Run Code Online (Sandbox Code Playgroud)
浏览器给出错误"Uncaught TypeError:Object#have method'getValue'"
我怎样才能获得这个价值?
| 归档时间: |
|
| 查看次数: |
8042 次 |
| 最近记录: |