在我的代码中我有这样一个:
<script type="text/javascript">
$(document).ready(function (e) {
$('#EventCreate').click(function (e) {
location.href = '@Url.Action("Create", "AEvents")';
});
});
</script>
<button id="EventCreate" type="button" class="btn btn-info" style="float:right;">Create New Event</button>现在,这是完美的,但我的任务是了解所有方面的原因,它的工作。
我读了一些这里的书,但它还没有在我的脑海中安定下来。而且,在引用中,提供的所有示例都没有处理程序。
我还尝试过调试,看看e有什么/是什么,但是运气是0。
我的问题是为什么有e?我知道e是一个事件处理程序,但这是否有效:
<script type="text/javascript">
$(document).ready(function (/* no event handler */) {
$('#EventCreate').click(function (/* no event handler */) {
location.href = '@Url.Action("Create", "AEvents")';
});
});
</script>任何帮助/解释都将不胜感激。
https://stackoverflow.com/questions/37860681
复制相似问题