Beginner Series: jQuery Tutorial
Every beginner must start with the infamous “hello world” tutorial so that’s exactly what we’re going to do here.
Writing the Code
Next, we’re going to write the code that will be used to print “hello world” on the screen through jQuery.
First, we’re going to write the plain HTML, which will look like the snippet below. Please note that you can modify the displayed message to say whatever you want, so long as you use the right HTML tags.
<html> <head> <title>HTML Hello World</title> Hello World in HTML. </body> </html>
After you have added that content inside the HTML file and saved the document, you should be able to open it in a browser and see the following message, “Hello World in HTML.”
Next, you will add the following snippet of code into your HTML document along with the close tags, in order to call upon the jQuery library:
This is meant to go in the body of your HTML content at the very top.
These are the close tags and they belong at the end of the main content, just before the closing body tag:
<div id="hello"> </div>
So, the final product should look just like this:
After you have saved your HTML file, you should be able to open it using your browser; you will see two lines of text, one for the HTML code and the other for the jQuery code.
Recommended Training – Treehouse
Although this site recommends various training services, our top recommendation is Treehouse.
Treehouse is an online training service that teaches web design, web development and app development with videos, quizzes and interactive coding exercises.
Treehouse's mission is to bring technology education to those who can't get it, and is committed to helping its students find jobs. If you're looking to turn coding into your career, you should consider Treehouse.
Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.