Click here to Skip to main content
15,908,254 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two javascript function and a button, i want when first function is return true then only it execute second function.
JavaScript
function validate() {
var category = document.getElementById('<%=dd_category.ClientID %>').value;
            if (category == "Select Category") {
                alert("Please select Category");
                return false;
            }
}
function loading(){
            document.getElementById("load").style.display = 'block';
        }

ASP.NET
<asp:Button ID="but_submit" runat="server" Text="Submit" 
     OnClientClick="return validate();" onclick="but_submit_Click"/>
Posted

1 solution

JavaScript
function validate() {
var category = document.getElementById('<%=dd_category.ClientID %>').value;
            if (category == "Select Category") {
                alert("Please select Category");
                return false;
            }
          loading(); // this is true condition then call your 2nd method 
}
 
Share this answer
 
Comments
Raj Negi 11-May-14 14:36pm    
thanks i got it.

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