如何启用用户在iPad safari上的readOnly html元素中选择? [英] How to enable user select in a readOnly html element on iPad safari?
问题描述
可能存在重复:
有一个不可编辑但可选择的文本框
I在我的网页上有一个HTML元素,它必须是只读的,以防止用户更新内容,使用 readOnly ='readOnly'
使元素不可选,文本内容为该元素根本无法复制。
有什么方法可以让元素只读,并且用户可以选择/复制文本内容???? 我只是删除了 readOnly
属性并添加了下面的 onkeydown
和 oncut
事件来模拟 readOnly
行为
< input type =textarea
onkeydown =event.preventDefault(); event.stopPropagation(); return false;
oncut =event.preventDefault(); event.stopPropagation(); return false;>
Possible Duplicate:
Having an uneditable, but selectable textbox
I have an HTML element in my web page on iPad and it must be read only to prevent users updating the content,using readOnly='readOnly'
makes the element unselectable and text content of the element can not be copied at all.
is there any way to make the element read only and the user can select/copy the text content????
just i removed the readOnly
attribute and added the following onkeydown
and oncut
events to simulate readOnly
behavior
<input type="textarea"
onkeydown="event.preventDefault();event.stopPropagation();return false;"
oncut="event.preventDefault();event.stopPropagation();return false;">
这篇关于如何启用用户在iPad safari上的readOnly html元素中选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!