如何为@for
循环中的每个项目提供不同的ID,以便我可以在jQuery
中使用该唯一ID来检索值?
@for (int i = 0; i < searchList.Count;i++ )
{
<label for="one"><input type="checkbox" id="one"/>@searchList[i]</label>
}
最佳答案
@for (int i = 0; i < searchList.Count;i++ )
{
<label for="one"><input type="checkbox" id="one_@i"/>@searchList[i]</label>
}
关于c# - 循环内的唯一 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30054739/