首页 新闻 会员 周边

C# mvc 清空表格中某列文本框内容

0
[已关闭问题] 解决于 2018-06-03 15:12

怎么点删除把这列对应的文本框清空,

  @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;

        });
复制代码

 

问题补充:

获取不到文本框

敲代码带的主页 敲代码带 | 初学一级 | 园豆:0
提问于:2018-05-30 13:43
< >
分享
其他回答(1)
0

$("input[name='ServiceTag']").val();能获取到值吗

大黄人 | 园豆:641 (小虾三级) | 2018-05-30 16:16

提示这个

支持(0) 反对(0) 敲代码带 | 园豆:0 (初学一级) | 2018-05-31 15:33
1
$('.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; });
沉淀的风 | 园豆:202 (菜鸟二级) | 2018-06-03 18:29

 $(this).parent().children().last("td").children("input:last-child").val("")

支持(0) 反对(0) 敲代码带 | 园豆:0 (初学一级) | 2018-06-08 17:15
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册