Skip to content
Advertisement

Change Height and Width of TextArea in codemirror

I am developing website which having xml, java programs. So i chose CodeMirror for displaying programs in TextArea. I had successfully displayed. It’s default height is 300px in codemirror.css. How to change Height and Width of TextArea programmatically in codemirror?

Advertisement

Answer

The CodeMirror user manual is your friend.

Example code:

<textarea id="myText" rows="4" cols="10"></textarea>

<script type="text/javascript" language="javascript">
    var myTextArea = document.getElementById('myText');
    var myCodeMirror = CodeMirror.fromTextArea(myTextArea);
    myCodeMirror.setSize(500, 300);
</script>
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement