CodeMirror markText is not working

Viewed 2997

I am using CodeMirror like this to show some XML response to User.

HTML CODE

<body>
    <textarea id="cm" >#{bean.xmlResponse}</textarea>
</body>

JS CODE

window.onload = function () {              
    var editor = CodeMirror.fromTextArea(document.getElementById('cm'), {
                    mode: "xml",
                    theme: "default"
                });

    editor.getDoc().markText({line:5,ch:2},{line:5,ch:9},"color : red");
};

Now when I am trying to highlight some particular line by using markText which is not working. Of course "xml" mode is working but line 5 is not highlighted with color red.

I really appreciate your help. It's been 3 days am trying to get it done. Thanks.

1 Answers
Related