这就是我正在尝试为ActionLink制作一个警告框。但它不起作用。
@Html.ActionLink("ADD", "BrandListComfirmed", new { id = item.brand_id }, new { onsubmit = "return confirm('Are u sure you want this brand? " + item.brand_name + "');" })
答案 0 :(得分:5)
锚点没有onsubmit
事件。请改用onclick
:
@Html.ActionLink(
"ADD",
"BrandListComfirmed",
new {
id = item.brand_id
},
new {
onclick = "return confirm('Are u sure you want this brand? " + item.brand_name + "');"
}
)