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
This works for me (TinyMCE version 4.7.6):
tinymce.activeEditor.fire("focus")
I've got it to work with TinyMCE 4.x by using the following:
tinymce.EditorManager.get('id_of_editor_instance').focus();
Finally found an answer... use the command:
tinymce.execCommand('mceFocus',false,'id_of_textarea');
For my purposes, 'id_of_texterea' was "description", ie
<textarea id="description" ... ></textarea>
In the form element that preceded my textarea, I added the execCommand above to the element's "onblur" action.
What actually works is setting an option in the configfile
(or jquery file) This option enables you to auto focus an editor instance. The value of this option should be an editor instance id. The editor instance id is the id
for the original textarea or <div>
element that got replaced.
Example of usage of the auto_focus
option:
tinyMCE.init({
//...
auto_focus : "elm1"
});
For Auto focus in tinymce the documentation first example says that - https://www.tinymce.com/docs/configure/integration-and-setup/#auto_focus
tinymce.init({
selector: '#textarea_id',
auto_focus: '#textarea_id'
});
This works for me in TinyMCE Version 4.7.6
This should pass focus to the TinyMCE textarea:
$("#id_of_tinyMCE_area").focus();