jQuery Hello World With Examples

Today we will look into jQuery Hello World program. In the earlier post, we discussed what is jQuery?. Here we will learn how to download and install it and then run a simple “jQuery Hello World” program.

Download jQuery

jQuery is a javascript library and comes in a single JS file, you can download it from jQuery Official Website. There are development and production versions, you can download any one of these to learn jQuery but in a production environment, you should use jQuery minified production version.

Installing jQuery

Once you have jQuery JS downloaded, you can use it in any HTML, JSP, PHP files by including it in the head section.

Note that the src path is relative here, in above case HTML and jQuery JS file should be in the same directory.

jQuery Hello World

Here is our first HTML with jQuery hello world functionality.

When I open above HTML in a browser, here is what I get after clicking on the last line.


jQuery Functions Explanation

$() is the syntax for jQuery function, here when DOM elements are ready or fully loaded, an element with id “msg” HTML is set by this function. Here we are using jQuery for manipulating the HTML data.

Here we are using the mouse click event to show the alert for all the elements with id “newdiv”. That’s all for getting started with jQuery and jQuery hello world program.

By admin

Leave a Reply

%d bloggers like this: