From what I've read about CodeMirror I should have onBlur
written to my Console Log when I Blur the textarea. Nothing gets echo'd.
var textarea = document.getElementById('block');
var editor = CodeMirror.fromTextArea(textarea, {
lineNumbers: false,
content: textarea.value,
onBlur: function () {
console.log("onBlur");
}
});
Have I missed anything out at all?
Bind it using .on()
as described in the CodeMirror's Events documentation.
var textarea = document.getElementById('block');
var editor = CodeMirror.fromTextArea(textarea, {
lineNumbers: false,
content: textarea.value,
});
editor.on("blur", function(){
console.log("onBlur");
});