JQuery in ASP.Net

JQuery is another javascript library which eases javascript developemt - and it also includes some Ajax functionality.

jQuery is a fast, lightweight JavaScript library that is CSS3 compliant and supports many browsers. The jQuery framework is extensible and very nicely handles DOM manipulations, CSS, AJAX, Events and Animations.

It is totally different from JavaScript because it is a language whereas jQuery is a library written using JavaScript.

You can download the source code & plugins and read some excellent tutorials at the JQuery website. jQuery was created by John Resig.

Display an alert on asp:Button click using jQuery:

Add a Button element to the page as shown below:

<asp:Button ID="Button1" runat="server" Text="Button" />

Now in order to tell the browser to perform some action using jQuery as soon as the document is ready or loaded, use this block:

<script type="text/javascript">
$(document).ready(function() {
// add code here
});

</script>
Add your code in the function block
<script type="text/javascript">
$(document).ready(function() {
$("#Button1").click(function() {
alert("Hello world!");
});

});
</script>
Tags: , ,
Hot on Web:


About author