输入标签值我有一个div更新锚标签点击
@{int index = 0;}
@for (int i = 0; i < Model.lstFiles.Count; i++)
{
<div id="attachmentDetail(@index)" name="attachmentDetail(@index)" class="panel-body">
<a asp-action="Download" asp-controller="Admin" asp-route-realName=Model.lstFiles[i].RealName>@Model.lstFiles[i].FileName</a>
<a onclick="btnDelFile_Click(@index)" id="btnDelFile{@index}" class="pull-right" title="delete"><img height="20" width="20" src="@Url.Content("~/images/delete.jpg")" /></a>
<input type="text" asp-for="@Model.lstFiles[i].IsDeleted" hidden />
<input type="text" asp-for="@Model.lstFiles[i].FileId" hidden />
<hr />
</div>
index++;
}
我要更新btnDelFile_Click
@Model.lstFiles[i].IsDeleted
值。但我无法获得div和它的孩子。我想这个代码
$('#attachmentDetail(' + index +') :input lstFiles['+index+'].IsDeleted').val("True");
但它说
jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #attachmentDetail(0)
有没有更好的办法让DIV的孩子?我想更新IsDeleted
的值,然后隐藏这个div。
任何形式的帮助将不胜感激。
工作就像一个魅力。谢谢 :) –