CodeMirror を使用して、C# コードのテキストを強調表示するテキストエリアを作成しました。しかし、テキストエリアの値を取得しようとすると失敗します。
私は自分のエディタを次のように作成しています
var editor = CodeMirror.fromTextArea(document.getElementById("txtCode"), {
lineNumbers: true,
mode: "text/x-csharp",
matchBrackets: true
});
無意味な言葉を書いて、次のような値を取得しようとすると:
alert(document.getElementById("txtCode").value);
戻り値:
if(true){}else{}
次のように取得しようとすると:
alert(document.getElementById("txtCode").getValue());
ブラウザに「Uncaught TypeError: Object # has no method 'getValue'」というエラーが表示される
この値を取得するにはどうすればよいですか?