Tôi đang sử dụng plugin Codemirror cho văn bản nhưng tôi không thể truy xuất giá trị của vùng văn bản.Cách lấy giá trị của Codemirror textarea
Code:
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-csrc"
});
function showCode()
{
var text = editor.mirror.getCode();
alert(text);
}
Nó được hiển thị lỗi:
editor.getCode() is not a function.
'console.dir (editor.morror)' và 'console.dir (trình soạn thảo)' hiển thị trong chrome là gì? – sissonb