Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
set timeout is working when it is calling in window.load() function but it is not working with button click event.please help me...

C#
function buttonclick() {
       
        setTimeout(function () { alert("sai"); }, 4000);
    }

above code is not calling set timeout event
but below code is working
$(document).ready(function () {

Var1 = setTimeout("CheckStatus()", 4000);

});



please help me
Posted

1 solution

Try this

XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
   <script type="text/javascript">
       var callTimeout = function () {
           setTimeout(function () { alert('hi'); }, 5000);
       }
   </script>
</head>
<body>
    <form id="frm" runat="server">
    <asp:Button ID="btn" runat="server" OnClientClick="callTimeout(); return false" Text="Test" />
    </form>
</body>
</html>
 
Share this answer
 
Comments
teja sai ravi 6-Feb-14 1:42am    
thanku so much dear friend.......
Karthik_Mahalingam 6-Feb-14 1:44am    
Welcom Ravi Teja:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900