Jquery button click event

Jquery button click event

You want to attach button click event in Jquery. Here is very basic example.

Add below script in head section of your page.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript" language="javascript">

$(document).ready( function (){ 

    $("#Button1").click( function(){
         alert("button clicked");


Html button example.

    <form id="form1" runat="server">
            <input id="Button1" type="button" value="button" />


We are using Google CDN hosted Jquery. $(“#Button1”) is to get html button element by it’s ID. Attach click event to found button control and insert your logic inside function() { // Your logic goes here. }

How to select html control by ID?

It’s very simple, just prefix # to the html element client side ID and pass it to $(“….”) function.


$(“#myButton”) will find html element by ID myButton.

$(document).ready(); ensures that all controls are completely loaded into browser.


JQuery Radio Button CheckedJquery Radio Button CheckedJquery image click eventLearning JqueryAndroid Button onClickListener ExampleHow To Hide Div On Click Using JQueryBasics of jqueryAndroid Button ClickJQuery On Click Change Div ContentJQuery SlideJQuery Hyperlink Click


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.