【发布时间】:2014-12-11 20:08:58
【问题描述】:
如何在点击图片时提交表单?该表单未使用以下代码提交。有没有办法在没有 jQuery 的情况下做到这一点?
剃须刀
@using (Html.BeginForm("AssignLabels", "Home", FormMethod.Post, new { name = "frm", id = "AssignLabelsForm" }))
{
<img src="@Url.Content("~/Images/Labels.png") />
}
jQuery
$('img').on("click", function () {
$(this).submit();
});
控制器
[HttpPost]
public ActionResult AssignLabels()
{
return View();
}
【问题讨论】:
-
当您调用提交时,您希望 图像 做什么?
-
而反对票是...?
标签: javascript jquery asp.net-mvc forms razor