Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有一些预设选项的 HTML 页面,当我使用纯 HTML 文本区域时,它可以正常工作,但是当我使用诸如“nicEditor”之类的富编辑器时,文本区域会失去焦点。
工作页面:这里
没有工作页面:这里
使用以下设置值:
nicEditors.findEditor("TextArea").setContent('text');
您不能专注于隐藏的元素。为了明确我的观点:使用富文本编辑器时,您输入的不是原始文本区域,而是编辑器提供的文本区域(甚至是iframe/div标签)。
iframe
div
因此,要将焦点放在编辑器窗口上,您需要将焦点设置在它上,而不是 textarea - 它实际上由 JS 填充。