隐藏文本输入光标(插入符号)通过覆盖元素Internet Explorer显示

问题描述:

我有一个窗体,其中有一个特殊的小部件,填充一个文本输入。当文本输入具有焦点时,小部件出现在文本输入上方(有意在其上方),并且用户点击其中的选项,当它们完成时,它消失并填充输入。在IE中有一个问题,当窗口小部件出现在输入上方时,字段的插入符(字段的闪烁文本输入光标)通过窗口小部件显示。小部件是一个正常的html / css dom结构。它仍然这样做,当我将窗口小部件的z-index设置为高于文本输入。我如何摆脱插入符号或确保它不发光?
我不想在窗口小部件显示的时间设置焦点在其他地方,因为窗口小部件要求输入具有焦点。

I have a form with a special widget that fills in a text input. When the text input has focus, the widget appears above the text input (intentionally above it) and the user clicks options in it, when they're done it disappears and fills in the input. There is a problem with this in IE, when the widget appears above the input, the field's caret (blinking text input cursor for the field) shows through the widget. The widget is a normal html/css dom structure. It still does this when I set the z-index for the widget to be above the text input. How can I get rid of the caret or make sure it doesn't shine through? I don't want to set the focus elsewhere for the duration that the widget is shown because the widget requires that the input has focus.

在显示窗口小部件时尝试将不可选择的属性设置为 code> off 。它是一个IE特定的属性,如果它的工作,你应该检查它在IE 8,因为我不知道它是否仍然支持。

Try setting the unselectable attribute to on while the widget is being shown, then to off at the end. It's an IE specific attribute, and if it works you should check it in IE 8, as I'm not sure if it's still supported.