How to make the cursor of codemirror appare onload the page ?

Hello , I want to show the cursor of codemirror on codemirror editor when I load the page … How I can do it ?

Maybe the focus method?

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 :frowning: @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

ok it work I must to write : editor.focus(); thank you @marijn