jquery - onClientClick executes and then the page postbacks immediately -


i have following code:

functions.js =>

function loadpopup() {     $("#backgroundpopup").css({         "opacity": "0.7"     });     $("#backgroundpopup").fadein("slow");     $("#popupcontact").fadein("slow"); }  //disabling popup jquery magic!   function disablepopup() {     $("#backgroundpopup").fadeout("slow");     $("#popupcontact").fadeout("slow"); }  //centering popup   function centerpopup() {     //request data centering       var windowwidth = document.documentelement.clientwidth;     var windowheight = document.documentelement.clientheight;     var popupheight = $("#popupcontact").height();     var popupwidth = $("#popupcontact").width();     //centering       $("#popupcontact").css({         "position": "absolute",         "top": windowheight / 2 - popupheight / 2,         "left": windowwidth / 2 - popupwidth / 2     });     //only need force ie6        $("#backgroundpopup").css({         "height": windowheight     });  }  function no() {     return false;     disablepopup(); }  function yea() {     $('#form1').submit(function () {         return true;     }) }  $(function () {     $("#popupcontactclose").bind('click', function () {         disablepopup();     }); });  function yeah() {     $(this).bind('click', function (event) {          centerpopup();          loadpopup();      }); } 

... , following markup:

<body>     <form id="form1" runat="server">     <asp:button id="btn1" runat="server" onclientclick="yeah();" text="click me!" />     <div id="popupcontact">         <a onclick="xclick()" id="popupcontactclose">x</a>         <input type="submit" onclick="yea()" value="yes" />         <input type="button" onclick="no()" value="no" />     </div>     <div id="backgroundpopup">     </div>     </form> </body> </html> 

problem onclientclick event calls yea(), div shows , disappears , page posts back. rather strange. can me this? in advance!

i think need snuff out event.

onclick="yea();return false;" 

will it.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -