Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about the fact that your code is fine (although other answers here should be considered) but your button is making a post back to the server and simply your browser does not have enough time to render the fade effect. </p> <p>To test this, add a <code>return false;</code> to the <code>OnClientClick</code> property. This will of course cancel your action on the server but you will obtain the fade effect:</p> <pre><code> &lt;asp: Button ... OnClientClick="startButtonClick();return false;"&gt;&lt;/asp:Button&gt; </code></pre> <p>To work around this and still submit your request, you can try to use the ASP.NET <code>__doPostBack</code> method in JavaScript</p> <p>ASP.NET:</p> <pre><code>&lt;asp:Button ID="startButton" class="startButton" runat="server" Text="Click Me!" OnClientClick="startButtonClick(this);return false;"/&gt; </code></pre> <p>JavaScript:</p> <pre><code>function startButtonClick(button) { $("#startButtonSpan &gt; input").fadeOut(500, function(){__doPostBack(button.name, "")}); } </code></pre> <p>The <code>__doPostBack</code> method takes two arguments: the name of the control that is doing the postback and a postback argument that can be use to send more info on the server. In the case of the <code>asp:Button</code>, the name of the button should be sufficient to send the request without a problem.</p> <p>Using this technique you will fade the button on the client and also trigger the action on the server. I cannot guarantee that this exact code will work (I don't have access to a dev environment right now) but you should get the idea.</p>
    singulars
    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.
 

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