本文介绍了调用JQuery并不会回发的Html按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以有一个不回发到服务器的按钮,并且jquery可以检测到点击事件?我有一个MVC页面,需要一段时间来加载和访问数据库,我只是想减少所需的负载和数据库命中的数量。
解决方案
<$ p> $ p $
<$ p> $ p $
$(#myButton)。click(function(){
无论我想要做什么...
});
Is it possible to have a button that doesn't post back to the server, and the click event can be detected by jquery? I have an MVC page that takes a while to load and access a database and i just want to reduce the number of loads required and db hits.
解决方案
Just make the button a regular button instead of a submit
button, and then do:
$("#myButton").click(function () {
whatever it is I want to do ...
});
这篇关于调用JQuery并不会回发的Html按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!