getValue seems not working

My problem is that I’m failing when I try to get the value of the textarea.

Here’s what I’ve written so far:

var code = $("#editor")[0];
var editor =  CodeMirror.fromTextArea(code, {
mode: {name: "pyhton",version: 2,
singleLineStringErrors: false
},
lineNumbers :true,
indentUnit: 4,
matchBrackets: true
});

and I’m trying to get the value with

var value = editor.getValue();

I’m getting an error saying

TypeError: editor.getValue is not a function

2 Likes

This text about variable scopes might help.

I have same problem as you, And no one can answer.