Javascript 如何禁用/取消对@Html.EditorFor生成的元素(内部文本)或表内容的选择
如何取消/禁用选择文本:Javascript 如何禁用/取消对@Html.EditorFor生成的元素(内部文本)或表内容的选择,javascript,jquery,html,asp.net-mvc-5.1,Javascript,Jquery,Html,Asp.net Mvc 5.1,如何取消/禁用选择文本: 由@Html.EditorFor 或者,如果没有,只需web应用程序中的任何文本 或者,如果没有,至少在下面这样的表格中显示文本: 通过禁用选择文本,我的意思是阻止标记/选择/选择文本的可能性,如下图所示: <table class="table"> <tr> <th> No. </th> <th>
- 由
@Html.EditorFor
- 或者,如果没有,只需web应用程序中的任何文本
- 或者,如果没有,至少在下面这样的表格中显示文本:
<table class="table">
<tr>
<th>
No.
</th>
<th>
@Html.DisplayNameFor(model => model.LastName)
</th>
<th>
@Html.DisplayNameFor(model => model.FirstName)
</th>
<th>
@Html.DisplayNameFor(model => model.CellNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.SecondaryPhoneNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.Address)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@noPerson @{noPerson++;}
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.CellNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.SecondaryPhoneNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address)
</td>
<td>
@Html.ActionLink("Details", "Details", new { id = item.Id }, new { @class = "btn btn-info btn-xs" }) |
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "btn btn-warning btn-xs" })
@if (Request.IsAuthenticated && User.IsInRole("Admin")) { <text> |</text>
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "btn btn-danger btn-xs" })
}
</td>
</tr>
}
</table>
不
@DisplayNameFor(model=>model.LastName)
@DisplayNameFor(model=>model.FirstName)
@DisplayNameFor(model=>model.CellNumber)
@DisplayNameFor(model=>model.SecondaryPhoneNumber)
@DisplayNameFor(model=>model.Address)
@foreach(模型中的var项目){
@noPerson@{noPerson++;}
@DisplayFor(modelItem=>item.LastName)
@DisplayFor(modelItem=>item.FirstName)
@DisplayFor(modelItem=>item.CellNumber)
@DisplayFor(modelItem=>item.SecondaryPhoneNumber)
@DisplayFor(modelItem=>item.Address)
@ActionLink(“Details”,“Details”,new{id=item.id},new{@class=“btn btn info btn xs”})|
@ActionLink(“编辑”,“编辑”,新建{id=item.id},新建{@class=“btn btn warning btn xs”})
@if(Request.IsAuthenticated&&User.IsInRole(“Admin”){|
@ActionLink(“Delete”,“Delete”,new{id=item.id},new{@class=“btn-btn-danger-btn-xs”})
}
}
在其他问题中,只需添加CSS即可
body{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
不知道“取消/禁用选择文本”是什么意思