Opera - 防止输入获得焦点
我的其中一个页面上有一个隐藏的输入,所谓隐藏,是指可见,但看起来就像纯文本。
举个例子 http://jsfiddle.net/imoda/nVhp8/
但我不想要用户能够单击它并编辑信息。本质上是禁用它,但没有在 html 中将其设置为 disabled
。我想我已经很接近了,但我所尝试的一切都不起作用。
似乎适用于除 Opera 之外的所有内容。请帮忙?
I have a hidden input on one of my pages, and by hidden, I mean visible, but just looks like plain text.
Take for example http://jsfiddle.net/imoda/nVhp8/
But I don't want a user to be able to click in it and edit the information. Essentially disabling it, but without setting it to disabled
in the html. I think I'm close but whatever I've tried isn't working.
Seems to work in everything except Opera. Help please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不简单地使用 readonly 属性,在单击编辑按钮后删除该属性,而不是使用 jQuery?
JS Fiddle。
参考文献:
只读
。Instead of using jQuery, why not simply use the
readonly
attribute, removing that attribute once the edit button has been clicked?JS Fiddle.
References:
readonly
.使用超时..
和更扩展的示例 http://jsfiddle.net/gaby/nVhp8/2 /
Use a timeout..
and a more extended example at http://jsfiddle.net/gaby/nVhp8/2/