javascript - 在 IE9 contenteditable 中显示错误的光标

标签 javascript html css internet-explorer-9

我有一些 html 如下(对于 IE9):

<div contenteditable="true">
   Some editable text
   <span class="code" contenteditable="true" unselectable="on">uneditable text</span>
   more editable text
</div>

在 IE9 中,span contenteditable 必须设置为“true”才能使 span 不可编辑,而在 Chrome 中必须设置为“false”才能使 span 不可编辑!

但是,在 IE9 中,当鼠标经过跨度时,光标显示为移动光标(交叉箭头)。光标在我的 css 文件中设置为“指针”,但这不适用于 IE9。

如何在 IE9 中将光标更改为手形或箭头?

最佳答案

以下内容在 IE9 和 Chrome 38 上都适用,范围内的内容可编辑的,范围外的文本不可可编辑。光标也与您将鼠标悬停在任何文本上时所期望的输入光标相同。

我注意到的唯一区别是,在 Chrome 上,span编辑 模式下以蓝色突出显示。

<div>
Some NOT editable text
<span class="code" contenteditable="true">EDITABLE text</span>
more NOT editable text
</div>

例如,Visual Stidio IDE 上的 HTML5 验证会告诉您 contententeditable 不是元素 div 的有效属性,unselectable 也不是元素 span 的有效属性。

如果您仍然遇到光标问题,请发布您的 CSS。

关于javascript - 在 IE9 contenteditable 中显示错误的光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27049625/

相关文章:

javascript - 如何从javascript中的另一个函数中的ajax成功访问变量

javascript - 将 Javascript 二维数组转换为 ArrayBuffer

javascript - 更改文本颜色而不更改边框颜色

javascript - 滚动时如何在水平条后面实现视差

javascript - CSS nth-child(odd) 与 Javascript 性能

固定的 CSS 位置不会出现在移动设备上

javascript - JQuery 旋转跨度 onclick

php - mysql 和 php select * 查询不起作用

javascript - 向所有 td 类添加一个额外的类名

html - 无法让 Font Awesome 图标在用户名旁边排列