无法在IE上输入框中选择文字 [英] Can't select text in input box on IE

查看:104
本文介绍了无法在IE上输入框中选择文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在div内的输入框,div有一个背景图像,其内部的输入框定位和限制大小/字体,以便与背景图像很好地工作。在FF中,一切都按预期工作,在IE中有一个主要问题。我无法使用鼠标选择输入框内的文本,或者使用shift-end / home,ctrl-left / right等快捷方式。您可以使用鼠标键移动,并使用删除/退格键来调整文本。 HTML看起来像这样:

 < div class ='my_container'> 
< input type ='text'name ='my_text_input'class ='my_input'/>
< / div>

任何见解将不胜感激。



我想添加一些更多的信息,我将Dojo dnd Target附加到外部div。如果我不附加dnd,那么我可以做选择,一旦我附加了dnd,我不能再选择文本了。

解决方案

一旦挖掘了由dojo执行的代码,这似乎是一个很直接的一步!!!



在传递给dojo.dnd.Target构造函数的对象中,需要将skipForm属性设置为true。



所以,它看起来像这样:

  var dndTarget = new dojo.dnd.Target(searchBox,{
isSource :false,
copyOnly:true,
selfCopy:false,
selfAccept:false,
skipForm:true //< - 这是FIX
}) ;

这似乎告诉dojo不要连接到输入元素,因此在IE中按预期工作。


I have an input box that is inside of a div, the div has a background image and the input box inside of it is positioned and limited in size / font to work nicely with the background image. In FF everything works as expected, in IE though there is a major issue. I can't select the text inside of the input box using the mouse or use short-cuts like shift-end/home, ctrl-left/right. You can move around using the mouse keys and use the delete/backspace keys to adjust the text. The HTML looks something like this:

<div class='my_container'>
  <input type='text' name='my_text_input' class='my_input' />
</div>

Any insight would be greatly appreciated.

I would like to add some more information, i'm attaching a Dojo dnd Target to the outside div. If I don't attach the dnd then I can do the selection, once i've attached the dnd, i can't select the text anymore.

解决方案

It seems that this is rather straight forward once one digs through the code being executed by dojo!!!

In the object being passed to the dojo.dnd.Target constructor, one needs to set the skipForm attribute to true.

so, it looks something like this:

var dndTarget = new dojo.dnd.Target(searchBox, {
  isSource: false,
  copyOnly: true,
  selfCopy: false,
  selfAccept: false,
  skipForm: true  // <-- THIS IS THE FIX
});

This seems to tell dojo not to connect to the input elements and thus works as expected in IE.

这篇关于无法在IE上输入框中选择文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆