jQuery Hello World

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

jQuery is a new technology? Definitely not, i rather said jQuery is a new approach to simplify client side web development like the HTML traversing with DOM and Ajax manipulation. iQuery was created by John Resig, a young kid, please visit his website to figure it out how this jQuery guy look like ~

Let go through a jQuery Hello World example to understand how it works.

1. Download jQuery Library

jQuery is just a small 20+kb JavaScript file (e.g jquery-1.2.6.min.js), you can download it from the jQuery official website. .

3. Demo

The $() indicate a a jQuery syntax, and the following script means when DOM elements are ready or fully loaded, execute the jQuery script to dynamic create a message and append it to html tag id “msgid”.

$(document).ready(function(){
$("#msgid").html("This is Hello World by JQuery");
});

how is jquery different from html in this example? they both are doing the same job!!

Vote Up0Vote Down Reply

4 years ago

Guest

Luciano Pinheiro

This is just the minimum example (I got here just to remember sintaxe). This minimal example just add a text to a div. The only difference for raw HTML is that jquery is working on client side. So, client browser just changed that div. This is not a very usable example, though. We use jQuery to add behavior to HTML pages AFTER they are “downloaded” to browser. Some things you can do: – change colors of elements – hide and show elements – retrieve elements from other pages (the whole page or just a piece of HTML) and many many… Read more »

Vote Up0Vote Down Reply

4 years ago

Guest

Isabella Cris

Hey Guys,
For advance JQuery developers I found below URL worthy. Here I found an excellent use of JQuery which I have never seen before.Please find below URL