Hello , I want to show the cursor of codemirror on codemirror editor when I load the page … How I can do it ?
it not work I write
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
onLoad : function(cm){
cm.focus();
}, });
this is the link : try
But it not work @marijn
The is no such thing as an onLoad
option, so indeed, that will not work. Put your call to focus
somewhere where it’ll actually be called when the page has loaded.
I rewrite the code to
window.onload = function(cm) {
alert("");
cm.focus();
};
the alert work fine onload ,But the focus not work … see the edit here here alert run onload but focus not run @marijn