How to set focus on the ace editor?

后端 未结 5 539
轻奢々
轻奢々 2021-02-03 18:54

I am using the ace editor component from ajax.org inside a jquery tab interface. Each tab will contain a separate ace editor. Whenever I switch to a new tab, the editor in it wo

5条回答
  •  猫巷女王i
    2021-02-03 19:42

    Here's an excerpt from my code that sets the focus on an Ace edit session in a jQuery UI tab:

        $('#tabs_div').tabs(
            {
                select : function(event, ui) {
                            var tabName = ui.panel.id;
                            var doc = docs.get(tabName);  // look up the EditSession
                            var session = env.split.setSession(doc);
                            session.name = tabName;
                            env.editor.focus();
                }
    

提交回复
热议问题