如何绑定变量中的Id
@item.ArticleId项目
我的用例是我必须显示
点击
添加注释按钮
下面是关于如何获取文章ID的代码:
<span id="addComment" onclick="AddaComment()"><i class="fa fa-comment" aria-hidden="true" ></i> Add a Comment</span>
<div id="Comment(@item.ArticleId)" style="display:none;">
<input type="hidden" name="ArticleId" id="ArticleId" />
<input type="text" name="Comments" />
<input type="submit" class="btn add-comment" value="Add Comment">
</div>
function AddaComment() {
var x = document.getElementById("Comment()");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}