按钮单击事件不在jQuery中触发 [英] Button click event not firing in jQuery
本文介绍了按钮单击事件不在jQuery中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是方法:
$(document).ready(function () {
$('btnDelete1').click(function () {
alert("something");
})
});
这是按钮的代码:
<input type="submit" value="Delete Role" disabled="disabled" id="btnDelete1"/>
但是每当我点击按钮时,警报就不会发生。这是为什么?
But whenever I click the button, the alert isn't happening. Why is this?
推荐答案
问题与MVC无关,你错过了#仅限Jquery选择器中的code>。
The problem isn't connected with MVC anyway, you missed #
in Jquery selector only.
$(document).ready(function () {
$('#btnDelete1').click(function () {
alert("something");
});
});
编辑:
正如杰弗里所说,你忘了;
太
And as mentioned Jeffrey, you forget ;
too
这篇关于按钮单击事件不在jQuery中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文