JQuery Hello World Sample

 Rate It (5)

Here is a jQuery hello world page for anybody wanting to get started with JQuery.

 
1. Download jQuery at http://docs.jquery.com/Downloading_jQuery#Download_jQuery

2. Place the “jquery-1.2.6.js” file into a folder called JQueryJS inside your ASP web application

3. Next create a default.js file in the same folder as the jquery-1.2.6.js file and paste the code below into the default.js file.

 

$(document).ready(function() {

    $("#helloWorld").click(function() {

        alert("Hello world!");

    });

});

   

4. Run the aspx page below and click the DIV to get started with JQuery.
more examples soon.

  <%@ Page Language="VB" AutoEventWireup="false" CodeFile="jQuery1.aspx.vb" Inherits="jQuery1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

<script type="text/javascript" src="JQueryJs/jquery-1.2.6.js"></script>

<script type="text/javascript" src="JQueryJs/default.js">

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

<div id="helloWorld" style="height: 194px; width: 260px; background-color: #FF9933"></div>

</div>

</form>

</body>

</html>

Revision number 2, Saturday, October 18, 2008 5:50:50 PM by Josh Ledgard

Comments

i do this but nothing happen no alert came to me :S

this is first time i have use this its really easy and simple

Related Articles

ASP.NET MVC Framework

Overview MVC (Model-View-Controller) now comes to ASP.NET too. As Scott Gu says "If you are looking to build your web applications using a MVC approach, I think you'll find this new ASP.NET MVC Framework option very clean and easy to use. It will

HTML login page using JQuery

Here is the login form it has user id and password text boxes. When user clicks Login button, it calls ajaxLogin.aspx page in background process using JQuery and it returns login success or failure message and prints in one span element. Example uses jquery

Javascript

JavaScript holds it all together on the client side. There are a number of extensions that have been made to improve and expand base JavaScript object functionality. Blog Posts Four ASP.NET AJAX JavaScript UI Methods You Should Learn: Dave Ward describes more

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. mbanavige (14)
  2. codehard (3)
  3. Babunareshnarra (2)
  4. Dungimon (1)
  5. cabhilash (1)
Microsoft Communities