【发布时间】:2012-06-08 07:07:24
【问题描述】:
我的表单上有许多输入字段,其中一个使用的是 TinyMCE(版本 3.5.2)。一旦 TinyMCE 加载,它就会将焦点设置为自身。我怎样才能防止这种情况发生?我想默认选择第一个输入。
这就是我的代码现在的样子
var tinymce = $('#Content');
tinymce.tinymce({
theme: "advanced",
plugins: "...",
theme_advanced_buttons1: "...",
theme_advanced_buttons2: "...",
theme_advanced_buttons3: "...",
theme_advanced_buttons4: "...",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
content_css: [...],
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",
template_replace_values: {
username: "Some User",
staffid: "991234"
}
});
更新:
经过更多测试,这个问题似乎只存在于 IE9 中。 Chrome、FireFox、Opera 和 Safari 不会在页面加载时将焦点设置到编辑器。 IE7 和 IE8 模式下的 IE9 也不会在页面加载时设置焦点,但即使您尝试将焦点设置到另一个输入,IE9 本身也会将焦点设置到编辑器。
不过,一旦您在 textarea 中加载具有值的页面,这一切都会发生变化。当你这样做时,IE9 就像其他浏览器一样工作。现在我正在加载页面,在 textarea 中有一个空格,这使得 IE9 可以正常工作。
【问题讨论】:
-
您使用的是旧版本的 TinyMCE 吗?
标签: javascript jquery tinymce