Friday 15 January 2021

jQuery - 2 ways to call button click function

 Watch this example on YouTube


 

    <input type="submit" id="btnSubmit" value="Submit" />   
   
}


@section Scripts{
    <script type="text/javascript">

        $(document).ready(function () {
            $("#btnSubmit").click(function () {
                alert("in first function")
            });
            $(document).on("click", "#btnSubmit", function () {
                alert("in second function")
            })
        });

    </script>
    }

No comments:

Post a Comment