How do you set the focus of a TinyMCE textarea ele

2020-02-24 10:57发布

I'm using TinyMCE for a textarea on a page but it doesn't play nice in the tabbing order of the other elements.

I can use the following code to capture when I tab out of the first element:

$('#title').live('keypress', function (e) {
   if(e.keyCode == 9) {
       alert('tabbed out');
   }
});

How can I set the focus to a TinyMCE editor?

13条回答
别忘想泡老子
2楼-- · 2020-02-24 11:54
tinyMCE.get('Description').getBody().focus();

The above works in Firefox, Chrome and IE as well. I have not tested in other browsers.

查看更多
登录 后发表回答