Note that there are some explanatory texts on larger screens.

plurals
  1. POonClientClick executes and then the page postbacks immediately
    primarykey
    data
    text
    <p>I have the following code:</p> <p>functions.js => </p> <pre><code>function loadPopup() { $("#backgroundPopup").css({ "opacity": "0.7" }); $("#backgroundPopup").fadeIn("slow"); $("#popupContact").fadeIn("slow"); } //disabling popup with jQuery magic! function disablePopup() { $("#backgroundPopup").fadeOut("slow"); $("#popupContact").fadeOut("slow"); } //centering popup function centerPopup() { //request data for 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 for 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(); }); } </code></pre> <hr> <p>... and the following markup:</p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:Button ID="btn1" runat="server" OnClientClick="yeah();" Text="Click me!" /&gt; &lt;div id="popupContact"&gt; &lt;a onclick="xClick()" id="popupContactClose"&gt;x&lt;/a&gt; &lt;input type="submit" onclick="yea()" value="Yes" /&gt; &lt;input type="button" onclick="no()" value="No" /&gt; &lt;/div&gt; &lt;div id="backgroundPopup"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>problem is that the OnClientClick event calls yea(), the div shows up and then disappears immediately and the page posts back. This is rather strange. Can you help me with this? Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload