且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何prevent回发ASP的按钮,同时显示使用JQuery弹出

更新时间:2022-12-30 19:52:35

其实你还没有露面的方法的实施 myfunction的(),以防在 myfunction的()方式有任何语法错误,那么在的OnClientClick 事件将被作废,并会后回/表单提交到服务器。

Actually you have not showed up the implementation of your method myfunction(), in case the myfunction() method have any syntactical error then the OnClientClick event will be void and it will post-back/submit the form to the server.

尝试删除从通话的的OnClientClick 并只实现你的逻辑在jQuery的在单击事件使用的类选择如下:

Try to remove the call from OnClientClick and just implement your logic at jquery on click event by using class selector as follows

$(document).ready(function () {
        $(".btnSearch").click(function (e) {
            e.preventDefault();
            alert($(this).val() + " Clicked"); // you can put your method mymethod() here 
            // you can put youe popup logic here

            return false; 

        });
    });

您还可以看到这个例子爵士小提琴

You can also see this example of js fiddle