Getting into jQuery

Swiss Army Knife Cadet 1

I have a friend that is wanting to get into learning and using jQuery so I thought that I would throw some information together to help them get started.

Documentation

Love jQuery’s documentation! I love being able to go to http://api.jquery.com/ and being able to quickly search for what I am looking for. This is great for when I know roughly what I want and just need a bit of information on how to do it. When I was starting out, the documentation main page was the place to be http://docs.jquery.com/

Including jQuery into projects

So you can download the jQuery code from the site and put it up on S3 or your own hosting service and include it into your projects that you are working on but why not let Google do it for you if it makes life easier? Google has a bunch of script libraries that they host for free that are used commonly. To include jQuery in your project stress free try this

Document Ready

One thing that can be frustrating when just starting out using jQuery is finding out the hard way of why you have to wait for the page to load before your functions can work. What??!! jQuery is a JavaScript library that extends native functionality of JavaScript and just plain makes JavaScript easier to work with. Problem is, none of your jQuery functions will work until the library is completely loaded and the structure of the html is in the browser. You can make sure your jQuery functions don’t try to do anything until the page is ready by putting your code in a document read wrapper that jQuery makes easy.

$(document).ready(function() {
  // Your jQuery code goes here
});

Shortcut

Because using jQuery is soo awesome and you are going to be using it soo much, the shortcut ‘$’ was used to reference jQuery. So the following two jQuery functions are the same.

jQuery("#ajax img").hide();
$("#ajax img").hide();

Help

Just remember when you get frustrated or you need help understanding something with jQuery do a Google search for what your having trouble with. If that doesn’t get you what you are looking for, ask a friend! There are many who have loved using jQuery and would love to help a friend out. Also, don’t forget the ever awesome http://stackoverflow.com/ which is a great place to find, ask, and answer programming related stuff! jQuery included.

Example

Here is a full and simple working example that I created just to show off a bit of the fun power of jQuery. Again, jQuery documentation rocks and has many examples but I thought this would be nice to pull together everything I had talked about here.

https://mikegrace.s3.amazonaws.com/geek-blog/jquery-example-1/jquery-example-1.html

photo by Quality & Style

Published by

MikeGrace

I am a Geek! I hope you enjoyed this recent post.

One thought on “Getting into jQuery”

Comments are closed.