jQuery Introduction

jQuery works by using functions, a library, written in JavaScript. You can use these functions to write powerful things without actually typing much code. jQuery is very lightweight and efficient so you don’t have to worry about it slowing down the user experience.

Referencing jQuery is extremely easy and there are multiple ways to do it. Remember that you can reference JavaScript from anywhere. You could even take the JavaScript that I am writing for this website and use it. The first way uses this principle. Google has a jQuery library available for all developers to use.

Example

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

If you have a trust issue with Google, you can always download their library and reference it like you would any other JavaScript file. Download the JQuery Library

The Syntax Difference

The basic syntax of jQuery is written much like how you would reference an object’s method. In JavaScript, we would do this by document.write, where document is the object and write is the method. jQuery is similar, but we are using selectors instead of objects, and including a $ at the beginning.

Example

$(selector).action();

The selector here is whatever we are referencing. It can be an HTML elements id, name, class, etc. You will have a better understanding of what I am talking about in the Selectors tutorial.

If you enjoyed this resource, support me by sharing this page with others.
Share on Facebook
Facebook
Share on Google+
Google+
Share on StumbleUpon
StumbleUpon
Digg this
Digg
Tweet about this on Twitter
Twitter
Share on Reddit
Reddit

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.