【问题标题】:disable field but allow to put the cursor on it and allow to copy from it禁用字段,但允许将光标放在其上并允许从中复制
【发布时间】:2014-06-10 08:11:49
【问题描述】:
我正在使用以下文本框,其中包含一个值,但它被禁用。
问题是这个文本框有我想允许用户在其中的值
可以从中复制值,目前的问题是我无法将光标放在它上面...
知道如何解决吗?我也尝试过只读并且有同样的问题......
<td class="display-field">
<b>@Html.TextBoxFor(model => model.EString, new { @style = "width: 100px;", placeholder = "Click", @disabled = true })</b>
</td>
【问题讨论】:
标签:
javascript
html
css
asp.net
asp.net-mvc
【解决方案1】:
使用光标:指针;内联样式和 readonly="true"
检查这个
<input style = "width:100px;cursor:pointer;" readonly ="true" value="hellohellohell"/>
【解决方案2】:
只读不工作?
<td class="display-field">
<b>@Html.TextBoxFor(model => model.EString, new { @style = "width: 100px;", placeholder = "Click", @readonly = "readonly" })</b>
</td>
【解决方案3】:
readonly="readonly" 将允许您从文本框中复制文本,但不允许您编辑文本。