Phonegap样式-webkit-user-select:无; 禁用文本字段

Phonegap相当新颖。 我有一个问题,在一个干净的PhoneGap项目中使用的默认CSS不允许input到文本字段。 我把它缩小到一行CSS:

* { -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ } 

问题是:

 -webkit-user-select: none; 

这可以在www / index.css中find。

似乎完全禁用input字段不是所需的效果。

我也发布了这个问题2次之前,但它被closures,不知道为什么…我的问题被closures,由于不是一个普遍的问题。 那么,我所能说的就是,我猜在stackoverflow的一些用户不认为CSS 3,PhoneGap,HTML 5和-webkit-user-select:是常见的情况。 我会乞求不同的。

不过,我可以看到这个问题也发布在这里,也导致Safari中的问题: 用户select:无导致input字段在Safari上无法访问虽然略有不同。

我目前的解决scheme是这样的

 -webkit-user-select: text; /* change 'none' to 'text' */ 

只是仍然好奇什么是最优雅的解决scheme,以启用文本input,但仍然保留了一些PhoneGap试图实现的副本和过去的function。 谢谢!

尝试添加到您的CSS:

 input { -webkit-user-select: auto !important; } 

这将覆盖您为input字段在每个单元素(通过*select器)上设置的文本select禁用。

只需通过这种方式将规则添加到CSS:

 *:not(input,textarea) { -webkit-touch-callout: none; -webkit-user-select: none; } 

user-select可能导致与contenteditable =“true”的元素的问题,所以更好地添加

  [contenteditable="true"] , input, textarea { -webkit-user-select: auto !important; -khtml-user-select: auto !important; -moz-user-select: auto !important; -ms-user-select: auto !important; -o-user-select: auto !important; user-select: auto !important; }