【发布时间】:2017-03-27 15:48:06
【问题描述】:
我有下面的简单代码,我需要在单击按钮时触发警报。但是没有触发事件。
@{
ViewBag.Title = "Dashboard";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$("#btnclickhere").click(function (e) {
alert(1);
e.stopPropagation(); // This is the preferred method.
return false; // This should not be used unless you do not want
// any click events registering inside the div
});
</script>
<h2>Dashboard</h2>
<table>
<tbody>
<tr>
<td>
<input type="text" id="textname" name="txtname" />
</td>
<td>
<input type="text" id="textpassword" name="textpassword" />
</td>
<td>
<input type="button" id="btnclickhere" name="btnclickhere" value="ClickHere" />
</td>
</tr>
</tbody>
</table>
有人可以帮我解决这里的问题吗?
【问题讨论】:
标签: jquery model-view-controller view