1,input框设置了readonly属性
<input type="text" name="name" value="123" readonly="readonly" />
readonly 属性规定输入字段为只读,不可以修改但是可以复制。
2,input框自身设置font-size为0
<input type="text" style="font-size: 0px;width: 100px;height:30px;" />
这种情况比较少见,但是有些时候,为了消除span元素之间的间隔会让font-size为0,此时input框应该是内容区为0*0个像素,如果强行设置input宽高,这时就算input框显示了,因为font-size为零,就啥也输不进去。
3,input框被其他元素挡住
<div style="width: 200px;height: 200px;float: left;position: absolute;z-index: 100;">
</div>
<input type="text" style="position: absolute;z-index: 10;" />
这种情况大致是因为浮动和z-index引起的,它的特点是即使点击input元素也不会出现选中状态,只要认真排查一下html的结构合不合理,就可以找到问题。
4,设置了用户不可选中文本,usr-select:none;
*{margin:0;padding:0;user-select: none;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;}
可能会因为浏览器的一些适配问题,导致你设置的user-select:none;影响到了input框的正常事件
5,return false;的使用清除了input框的默认事件
我们知道使用stopPropagation(); 可以阻止默认的冒泡事件,使用preventDefault();可以消除默认事件,但是在使用中贪图方便直接用return false;来代替以上两种方法,阻止默认事件用reutrn false,但是在jquery中,reutrn false;既阻止了冒泡,又消除了默认事件,如果不清楚这一点很有可能在使用on绑定事件时,使用reutrn false;消除冒泡的时候也消除了默认事件,导致input框无法输入内容。