Give Me 15 Minutes and I’ll Make You A jQuery Expert

Introduction

jQuery - Write Less, Do MoreIn the spirit of rapid web development, I’ve stumbled upon jQuery. Here’s a testimonial from a jQuery user:

You start with 10 lines of jQuery that would have been 20 lines of tedious DOM JavaScript. By the time you are done it’s down to two or three lines and it couldn’t get any shorter unless it read your mind.”

In my experience it’s been more like five (5) lines of jQuery.

jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.

I’ve found jQuery great for the following reasons:

  • Simple Ajax in a breeze
  • Search for elements in the DOM is made easy
  • The helper function [ $() ] is a pleasure to use
  • Most importantly: it handles cross browser compatibility.

Here We Go – Tutorials Galore

Your first step will be to Download jQuery 1.2.1 and include it in the head of your web page. After this you need to start reading some tutorials. Don’t worry, it’s going to take 15 minutes tops for you to start writing usable code:

Why I Use jQuery

jQuery is fast, small, and easy to learn. It’s the core for many of the simpler Ajax I use in my web pages. Since I’m using CakePHP, there’s also Prototype, but that’s another story. I really don’t like having to learn a new language when I’m trying to do something simple. I don’t want to go delving into DOM and all that stuff just to dynamically add a class onto an element in the form. If I was a JavaScript programmer, it may not be a big deal for me. But, to me, there’s nothing worse than writing bad code to get something done, just because you don’t understand what’s going on. That’s why frameworks are what I live by.

Don’t wait, get started with jQuery today.

Comments

  1. Hi,

    Do you know of any easy way to use jquery with cake? I just starting out on both and was wondering if you knew of any resources for that.

    Thanks for any help.

    Travis

    • Silver Knight says:

      In my personal experience, jQuery is as simple to use with CakePHP (or any other web framework for that matter) as it is to use with plain vanilla PHP/HTML.

      My suggestion is to do a few experiments with the resources listed here and on the jQuery documentation pages to get a feel for how jQuery works and then start playing with the CakePHP JavaScript helper and loading up jQuery in a few Cake views and doing further experiments there. You’ll be coding with jQuery in no time at all…

  2. I too have been looking for a simple tutorial on doing an ajax page update with cakephp and jquery. There are some outdated prototypejs tutorials from 2006 but not much on jquery yet.