settimeout to blink of button
<p>In jquery I have a button with a fading effect:</p>

<pre><code>function blinky() {
    $('#ButtonContent_btnSubmit').delay(100).fadeTo(100, 0.5).delay(100).fadeTo(100, 1, blinky);    
}
</code></pre>

<p>This causes a nice blinking effect, but I only want the blinking effect to last for say 10 seconds.</p>

<p>I want it to only blink for say 10 seconds...Could I apply <code>setTimeout()</code> to this?  I tried to apply setTimeout like so:</p>

<pre><code>function blinky() {
    setTimeout($('#ButtonContent_btnSubmit').delay(100).fadeTo(100, 0.5).delay(100).fadeTo(100, 1, blinky), 100);  
}
</code></pre>

<p>But this does not seem to work.</p>

<h1>Edit</h1>

<p>Im a jquery noob so Im trying to get this to work...
Lets say here is my document ready:</p>

<pre><code>$(document).ready(function () {
 if ($('#StatusContent_ddlStatus').val() == "Not Submitted" &amp;&amp; $("#LineItemContent_gvLineItems tr").length &gt; 0) {
              blink();
        }
});

var count = 0;

function blink() {
    if (++count &lt; 10)
        $('#ButtonContent_btnSubmit').delay(100).fadeTo(100, 0.5).delay(100).fadeTo(100, 1, blink);
}​
</code></pre>

<p>In developer tools (chrome) it throws some sort of exception...</p>

<h2>Edit 2</h2>

<p>If I put it all in document ready:</p>

<pre><code> $(document).ready(function () {
     if ($('#StatusContent_ddlStatus').val() == "Not Submitted" &amp;&amp; $("#LineItemContent_gvLineItems tr").length &gt; 0) {
                  blink();
            }

 var count = 0;

    function blink() {
        if (++count &lt; 10)
            $('#ButtonContent_btnSubmit').delay(100).fadeTo(100, 0.5).delay(100).fadeTo(100, 1, blink);
    }​

    });
</code></pre>

<p>Then in developer tools it says Uncaught syntax error: Unexpected token illegal.</p>

<h1>Edit 3</h1>

<p>I tried to place it at the top before calling it:</p>

<pre><code>$(document).ready(function () {
        var count = 0; 
        var f = 0;

         function blink() { 
            if (++count &lt; 10) 
                $('#ButtonContent_btnSubmit').delay(100).fadeTo(100, 0.5).delay(100).fadeTo(100, 1,        blink); 
            }

          if ($('#StatusContent_ddlStatus').val() == "Not Submitted" &amp;&amp; $("#LineItemContent_gvLineItems tr").length &gt; 0) {
            blink();
        }
});
</code></pre>

<p>Same issue...</p>
