Add the jQuery-1.11.0.js to the Solution Explorer and drag and drop the jquery-1.11.0.js file from the Solution Explorer onto your default.aspx page as shown below.

To display an alert on a Button click using jQuery, add a Button element to the page as shown below:
<asp:Button ID="Button1" runat="server" Text="Button" />
Now add a script tag to add some jQuery function as in the following block:<script type="text/javascript">
$(document).ready(function() {
// add code here
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#Button1").click(function() {
alert("Hello world!");
});
});
</script>

To do some animation on button click using jQuery, add a HTML button and a <asp:Panel> to the page as shown below:
<form id="form1" runat="server">
<input id="btnAnimate" type="button" value="Animate" />
<asp:Panel ID="Panel1" runat="server">
Some sample text in this panel
</asp:Panel>
</form>
<style type="text/css">
div {
background-color:#D5EDEF;
color:#4f6b72;
width:50px;
border: 1px solid #C1DAD7;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$("#btnAnimate").click(function() {
$("#Panel1").animate(
{
width: "350px",
opacity: 0.5,
fontSize: "16px"
}, 1800);
});
});
</script>


Comments
Join the conversation! Your thoughts help the community grow.