简体   繁体   English

iOS Webkit只读输入可选吗?

[英]iOS Webkit readonly inputs selectable?

I have a site where i use readonly inputs. 我有一个使用只读输入的网站。 On the desktop I use js to select the input field on the first click. 在桌面上,我使用js在第一次单击时选择输入字段。

<input readonly="readonly" type="text" class="select" value="Value to select">

$('.select').click(function(){
    $(this).select();
});

But in Safari for iOS I can't the select the input text at all (long tap on the text). 但是在iOS版Safari中,我根本无法选择输入文本(长按文本)。 Is there a way to make the text selectable? 有没有办法使文本可选?

have you tried something like this? 你尝试过这样的事情吗? Sometimes focus solves the problem, also perhaps the browser isn't aware that select() should trigger the event?: 有时焦点可以解决问题,也许浏览器也不知道select()应该触发事件?

$(this).focus().trigger('select');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM