怎么点删除把这列对应的文本框清空,
@foreach (var item in Model.PagedList) { <tr> @if ((UserInfo.CurrUser.RoleID == 43 || UserInfo.CurrUser.RoleID == 1) && operate == "ReportUpdate") { <td > @if (item.ServiceTag != null ) { <a class="ServiceTag" href="#">@res.Delete</a> } </td> } <td>@Html.DisplayFor(modelItem => item.IRN) </td> <td> @if (operate == "ReportUpdate") { @Html.EditorFor(modelItem => item.ServiceTag) } else { @Html.DisplayFor(modelItem => item.ServiceTag) } </td> </tr> //t = t + 1; }
$('.ServiceTag').click(function () { if (confirm('确认要删除此Servicetag ?')) { alert($("input :last-child ").val()); $("input :last-child ").val() = ""; return true; } return false; });
获取不到文本框
$("input[name='ServiceTag']").val();能获取到值吗
提示这个
$('.ServiceTag').click(function () { if (confirm('确认要删除此Servicetag ?')) {
//先找到该a标签的tr行对象, 再去寻找该行下的input[name="item.Servicetag"] $(this).parent("tr").find('input[name="item.Servicetag"]').val(""); return true; } return false; });
$(this).parent().children().last("td").children("input:last-child").val("")