Codemirror autoresize upto a given number of lines - Javascript CodeMirror

Javascript examples for CodeMirror:Configuration

Description

Codemirror autoresize upto a given number of lines

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>jQuery CodeMirror Plugin Sample</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.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> 
      <style id="compiled-css" type="text/css">

.CodeMirror {/* www.j  av a 2  s  .  c om*/
   border: 1px solid #eee;
   height: auto;
   max-height:100px;
}
.CodeMirror-scroll {
   height: auto;
   max-height:100px;
}


      </style> 
      <script type="text/javascript">
    $(window).load(function(){
var editor = CodeMirror.fromTextArea(document.getElementById("input"), {
    lineNumbers: true,
});
    });

      </script> 
   </head> 
   <body> 
      <textarea id="input">
#this is editable in-browser python code!
coefficients = [1,12,4,2,8]
significant_figures = 4
approximate_mode = True</textarea>  
   </body>
</html>

Related Tutorials