How to use JQuery in ASP.Net ?

In this asp.net post we will learn to use JQuery in ASP.Net, before start to learn we must know about JQuery.

What is JQuery ??

JQuery is a JavaScript Library.
JQuery is a lightweight, simple and fast JavaScript library which is supports many browsers.
JQuery is a library written using JavaScript, where as JavaScript is a language.

First, we must include JQuery library in our web form.

Download latest version on JQuery from http://jquery.com/.

After Downloading JQuery library include it to head Section of web form like below.

<head runat=”server”>
<title>Learn JQuery in ASp.Net</title>
<script src=”jquery-1.4.3.min.js” type=”text/javascript”></script>
</script>
</head>

Now, you can write your JQuery code in head Section.

Here, we take one Example for understand how to use JQuery in ASP.Net.

Show the alert() box while clicking the ASP.Net Server Button Control.

First, Design the ASP.Net web page with one Button control.

How to use JQuery in ASP.Net.
How to use JQuery in ASP.Net.

Now, While we click the Button at that time the alert box will show message.

write below JQuery code in head section on web form.

<head runat=”server”>
<title>Learn JQuery in ASp.Net</title>
<script src=”jquery-1.4.3.min.js” type=”text/javascript”></script>
<script>
$(document).ready(function() {
$(“#Button1”).click(function() {
alert(“Hello Meera Academy !!”);
});
});
</script>
</head>

Here, above we added JQuery library and write JQuery code for show the alert box.

The Button1 is our server control button ID.

The Result of this JQuery Example is :

How to use JQuery in ASP.Net.
How to use JQuery in ASP.Net.

 

Leave a Reply

Your email address will not be published. Required fields are marked *