javascript - CodeMirror using jQuery .keyup on editor textarea -


i want getvalue of codemirror editor on keyup did not work. here's the fiddle

var mixedmode = {         name: "htmlmixed",         scripttypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,                        mode: null},                       {matches: /(text|application)\/(x-)?vb(a|script)/i,                        mode: "vbscript"}]       };       var editor = codemirror.fromtextarea(document.getelementbyid("html"), {mode: mixedmode,linenumbers: true  });  $(document).ready(function(){   $("#html").keyup(function(){     html = editor.getvalue();     alert(html);     }); });  

codemirror hides textarea element, listening events of editor instance can use on method:

$(document).ready(function () {     editor.on('change', function () {         html = editor.getvalue();         alert(html);     }); }); 

you can find list of supported events in codemirror's manual.

http://codemirror.net/doc/manual.html#events


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -