Javascript examples for CodeMirror:Configuration
CodeMirror and jQuery .keyup event handler
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://codemirror.net/lib/codemirror.css"> <script type="text/javascript" src="https://codemirror.net/lib/codemirror.js"></script> <script type="text/javascript" src="https://codemirror.net/mode/javascript/javascript.js"></script> <script type="text/javascript"> $(window).load(function(){//from w w w .j a va2 s . c om var editor = CodeMirror.fromTextArea(document.getElementById('text'), { lineNumbers: true, matchBrackets: true }); $("#text1").keyup(function() { editor.setValue($(this).val()); }); }); </script> </head> <body> <textarea id="text"></textarea> <textarea id="text1"></textarea> </body> </html>