LESSON 2: JQUERY

LESSON 2




jQuery




jQuery:


jQuery is a powerful tool that can be used for website development. jQuery is a library of JavaScript commands and instructions that can be used in your web design in the place of full JavaScript. The motto of jQuery is "write less, do more", and they attempt to achieve this goal by condensing JavaScript functions into simpler and more intuitive structure. jQuery is an open source programming structure, and can be utilized and modified by anyone. jQuery uses sets of code and they are called jQuery plugins, because they plug in to your website and allow you to use their power.

jQuery needs to be loaded at the beginning of your HTML document. The section that calls the jQuery is going to be in the <head> </head> section. Google and the jQuery community have made it easy to remotely access the main jQuery library via a link. There are two main links to use, one for an older version of jQuery, and one for the newest version that is currently available. Those two links can be found at https://developers.google.com/speed/libraries/devguide. Once you navigate there, scroll down to the jQuery section.

Next we will talk about how to add this to your HTML.



Adding jQuery to your HTML:


To add jQuery to your HTML you need to define that you will be using JavaScript, and you must link to the external jQuery library (or you can link to it internally if you have it downloaded for use).

A section that defines your link to jQuery and calls a jQuery plugin will look something like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="js/animated-menu.js" type="text/javascript"></script>

In the section above we call the Google Hosted Library with our first line of code. The second line of code calls a local jQuery plugin called "animated-menu.js". This will allow the webpage that this code is on to run jQuery and to run this specific jQuery plugin.

PREVIOUS: JavaScript
NEXT: jQuery Hover