捕获提交按钮jquery的点击事件 [英] capture click event of submit button jquery
本文介绍了捕获提交按钮jquery的点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在表单上获取提交按钮的点击事件...
I am trying to get the click event of a submit button on my form...
<input type="submit" value="Search By Demographics" class="button" id="submitDemo"/>
那是我要从中获取事件的按钮.
That is the button that I want to get the event from.
$('#submitDemo').click(
alert("work darn it!!!!!!!!!!!!!!!!!!!!!!!!!")
//$("#list").block({ message: '<img src="../../Images/ajax-loader.gif" />' })
);
这是我要在单击按钮时执行的操作.我想在div周围放置一个加载图像,然后稍后在其他函数中取消阻止.当前,页面加载时会弹出叠加层,而不是onClick.我在做什么
This is what I want to do on button click. I want to put a loading image around a div and then unblock later in a different function. Currently the overlay pops up when the page loads instead of onClick. What am I doing
推荐答案
尝试一下
$('#submitDemo').live("click",function() {
// your stuff
});
正如@ px5x2所指出的那样,live已过时,因此请不要使用live on
As @px5x2 pointed that live is deprecate so instead of live use ON
$('#submitDemo').on("click",function() {
// your stuff
});
这篇关于捕获提交按钮jquery的点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文