Monday, September 7, 2015

Button On Click Event Using JQuery

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demo.aspx.cs" Inherits=".demo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script>

        /*  Button On Click Functions Using JQuery */
        $(document).ready(function () {


            /*  HTML Button Click Event */
            $("#btnHTML").click(function () {

                alert("You clicked on HTML Button");

            });


            $("#<%=btnaspnet.ClientID %>").click(function () {
                alert("You clicked on Asp.Net Button");
            });



        });

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <%--This is HTML Button--%>
        <input type="button" value="HTML Button" id="btnHTML" />
        <%--This is Asp.Net Button--%>
        <asp:Button runat="server" ID="btnaspnet" Text="Asp.Net" />
    </div>
    </form>
</body>
</html>

No comments:

Post a Comment