SlideShare a Scribd company logo
1 of 12
Everything You Need to Know
In Order to Start Using jQuery
        A Play in Three Acts
           by Dave Ross
       Suburban Chicago PHP
     & Web Development Meetup
           July 30, 2008
What is jQuery?

Remember when you tried learning Javascript ten
   years ago and you wanted to hunt down the
person who invented it and beat their head in with
               a rusty crowbar?

                   Forget that.

        Seriously. That stuff ain't healthy.
What is jQuery?
jQuery is a Javascript library for manipulating
             elements on a page.

 jQuery takes care of cross-browser issues.

jQuery is shorter and easier to read than old-
          fashioned DOM scripting.

jQuery comes with cool effects, and you can
            download more.
Why use jQuery?

If you use jQuery, you will become a Web 2.0™
                   superstar.

You will be able to found a startup, get funded by
 Y Combinator, attend all the hottest parties at
 Google, and Leo Laporte will drop your name
                    incessantly.
Everything you need to
$('#example').fadeOut();

#example...where have I seen that before? Oh yeah, it's a CSS
selector!

You can use pretty much any CSS selector as a parameter in $().

For example:
$('div.sidebar');
$('table#salaries');
$('div.sidebar h1');
Getting hungry already?
You can probably skip the rest and read the docs at:

http://docs.jquery.com

There are tutorials at:

http://docs.jquery.com/Tutorials




Still here?
Everything you need to

$() returns a set of elements that match that CSS selector.
Anything you tack on at the end is applied to all of them.

$('p').slideUp() makes every paragraph disappear. Not cool! Don't
do that.

$('#example').fadeOut() only effects one element, the one with
id=”example”. It's much more specific.
Let's see an example!
<script src=”/path/to/jquery-1.2.3.js”
type=”text/javascript” />
<script type=”text/javascript”>
function clickHandler()‫‏‬
{
  $('#example').fadeOut();
}
</script>
<div id=”example”
onclick=”clickHandler();”>test</div>
jQuery UI

$('#example').fadeOut();

Why do I keep using that example? That's what you're going to be
using jQuery for most of the time, fading things in & out like you
think you're Google or something.

fadeOut() is one of the jQuery Effects (show, hide, fade, and slide).

Also, there are fancier animations in the jQuery UI library @
ui.jquery.com – stuff like “split the div into 36 pieces and send
each of them flying in a different direction”.
Events
jQuery makes working with events much easier.

Events are things like ready (when the page is fully loaded), click,
focus, keydown, resize, submit, etc.

$('#example').focus() gives the #example element focus.

$('#example').focus(focusHandler) says to call
focusHandler() when #example gets focus.

$(document).ready(readyHandler) says to call
readyHandler() when the page is done loading.
Closures
While we're talking about events, this would be a good time to
discuss closures.

Some functions expect you to pass them the name of another
function to call later. You can use a closure to define that function
right then & there.

Instead of $('#example').focus(focusHandler), with
focusHandler() defined somewhere else, you can say:

$('#example').focus( function() {
  // Everything focusHandler would do
  // can be done here, not off in some
  // other file somewhere
  alert('Hello world!');
});
Cliff's Notes


The most important things I hope you learned:

$('some CSS selector')‫‏‬

http://docs.jquery.com

More Related Content

What's hot

jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6Andy Sharman
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');mikehostetler
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1Sebastian Pożoga
 
Evented Javascript
Evented JavascriptEvented Javascript
Evented Javascriptwaw325
 
Jquery introduce
Jquery introduceJquery introduce
Jquery introduceMajor Ye
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuerykolkatageeks
 

What's hot (20)

jQuery
jQueryjQuery
jQuery
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
 
jQuery
jQueryjQuery
jQuery
 
The jQuery Library
The  jQuery LibraryThe  jQuery Library
The jQuery Library
 
jQuery
jQueryjQuery
jQuery
 
Game jump: frontend introduction #1
Game jump: frontend introduction #1Game jump: frontend introduction #1
Game jump: frontend introduction #1
 
Evented Javascript
Evented JavascriptEvented Javascript
Evented Javascript
 
Jquery introduce
Jquery introduceJquery introduce
Jquery introduce
 
How to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQueryHow to increase Performance of Web Application using JQuery
How to increase Performance of Web Application using JQuery
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 

Viewers also liked

TeorÍA De Campos Web
TeorÍA De Campos   WebTeorÍA De Campos   Web
TeorÍA De Campos Weblucasmerel
 
Nuestro Propio Blog con blogger
Nuestro Propio Blog con bloggerNuestro Propio Blog con blogger
Nuestro Propio Blog con bloggerestudiantesblog
 
Experiencias de Participación en Nudo Estoril
Experiencias de Participación en Nudo EstorilExperiencias de Participación en Nudo Estoril
Experiencias de Participación en Nudo EstorilVisnja Tomicic
 

Viewers also liked (6)

TeorÍA De Campos Web
TeorÍA De Campos   WebTeorÍA De Campos   Web
TeorÍA De Campos Web
 
Open Innovation
Open InnovationOpen Innovation
Open Innovation
 
Open Innovation
Open InnovationOpen Innovation
Open Innovation
 
Portfolio
PortfolioPortfolio
Portfolio
 
Nuestro Propio Blog con blogger
Nuestro Propio Blog con bloggerNuestro Propio Blog con blogger
Nuestro Propio Blog con blogger
 
Experiencias de Participación en Nudo Estoril
Experiencias de Participación en Nudo EstorilExperiencias de Participación en Nudo Estoril
Experiencias de Participación en Nudo Estoril
 

Similar to Everything You Need to Know in Order to Start Using jQuery

J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaztestingphase
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxAditiPawale1
 
Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3luckysb16
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Jquery, write less do more by weLaika
Jquery, write less do more by weLaikaJquery, write less do more by weLaika
Jquery, write less do more by weLaikaFilippo Dino
 
Jquery optimization-tips
Jquery optimization-tipsJquery optimization-tips
Jquery optimization-tipsanubavam-techkt
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive OverviewMohamed Loey
 
Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuerySteve Krueger
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Thinqloud
 
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..Mark Rackley
 

Similar to Everything You Need to Know in Order to Start Using jQuery (20)

Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
J query intro_29thsep_alok
J query intro_29thsep_alokJ query intro_29thsep_alok
J query intro_29thsep_alok
 
J Query(04 12 2008) Foiaz
J Query(04 12 2008) FoiazJ Query(04 12 2008) Foiaz
J Query(04 12 2008) Foiaz
 
jQuery quick tips
jQuery quick tipsjQuery quick tips
jQuery quick tips
 
JQuery_and_Ajax.pptx
JQuery_and_Ajax.pptxJQuery_and_Ajax.pptx
JQuery_and_Ajax.pptx
 
Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3Learning jquery-in-30-minutes-1195942580702664-3
Learning jquery-in-30-minutes-1195942580702664-3
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Jquery, write less do more by weLaika
Jquery, write less do more by weLaikaJquery, write less do more by weLaika
Jquery, write less do more by weLaika
 
jQuery
jQueryjQuery
jQuery
 
J Query
J QueryJ Query
J Query
 
J query training
J query trainingJ query training
J query training
 
Jquery optimization-tips
Jquery optimization-tipsJquery optimization-tips
Jquery optimization-tips
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive Overview
 
Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuery
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...Learning jQuery made exciting in an interactive session by one of our team me...
Learning jQuery made exciting in an interactive session by one of our team me...
 
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
#SPSEMEA SharePoint & jQuery - What I wish I would have known a year ago..
 

More from Dave Ross

Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassDave Ross
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & FeaturesDave Ross
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hiredDave Ross
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDBDave Ross
 
Date and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDate and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDave Ross
 
Simulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardSimulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardDave Ross
 
What's new in HTML5?
What's new in HTML5?What's new in HTML5?
What's new in HTML5?Dave Ross
 
The Canvas Tag
The Canvas TagThe Canvas Tag
The Canvas TagDave Ross
 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack OptimizationDave Ross
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF LibraryDave Ross
 
Bayesian Inference using b8
Bayesian Inference using b8Bayesian Inference using b8
Bayesian Inference using b8Dave Ross
 
SQL Injection in PHP
SQL Injection in PHPSQL Injection in PHP
SQL Injection in PHPDave Ross
 
Web App Security: XSS and CSRF
Web App Security: XSS and CSRFWeb App Security: XSS and CSRF
Web App Security: XSS and CSRFDave Ross
 
The Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveThe Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveDave Ross
 
Balsamiq Mockups
Balsamiq MockupsBalsamiq Mockups
Balsamiq MockupsDave Ross
 
LAMP Optimization
LAMP OptimizationLAMP Optimization
LAMP OptimizationDave Ross
 
Lint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingLint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingDave Ross
 
Cufon - Javascript Font Replacement
Cufon - Javascript Font ReplacementCufon - Javascript Font Replacement
Cufon - Javascript Font ReplacementDave Ross
 

More from Dave Ross (20)

Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and Compass
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hired
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDB
 
Date and Time programming in PHP & Javascript
Date and Time programming in PHP & JavascriptDate and Time programming in PHP & Javascript
Date and Time programming in PHP & Javascript
 
Simulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention WizardSimulated Eye Tracking with Attention Wizard
Simulated Eye Tracking with Attention Wizard
 
What's new in HTML5?
What's new in HTML5?What's new in HTML5?
What's new in HTML5?
 
The Canvas Tag
The Canvas TagThe Canvas Tag
The Canvas Tag
 
Wordpress
WordpressWordpress
Wordpress
 
Lamp Stack Optimization
Lamp Stack OptimizationLamp Stack Optimization
Lamp Stack Optimization
 
The FPDF Library
The FPDF LibraryThe FPDF Library
The FPDF Library
 
FirePHP
FirePHPFirePHP
FirePHP
 
Bayesian Inference using b8
Bayesian Inference using b8Bayesian Inference using b8
Bayesian Inference using b8
 
SQL Injection in PHP
SQL Injection in PHPSQL Injection in PHP
SQL Injection in PHP
 
Web App Security: XSS and CSRF
Web App Security: XSS and CSRFWeb App Security: XSS and CSRF
Web App Security: XSS and CSRF
 
The Mobile Web: A developer's perspective
The Mobile Web: A developer's perspectiveThe Mobile Web: A developer's perspective
The Mobile Web: A developer's perspective
 
Balsamiq Mockups
Balsamiq MockupsBalsamiq Mockups
Balsamiq Mockups
 
LAMP Optimization
LAMP OptimizationLAMP Optimization
LAMP Optimization
 
Lint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code CheckingLint - PHP & Javascript Code Checking
Lint - PHP & Javascript Code Checking
 
Cufon - Javascript Font Replacement
Cufon - Javascript Font ReplacementCufon - Javascript Font Replacement
Cufon - Javascript Font Replacement
 

Recently uploaded

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Everything You Need to Know in Order to Start Using jQuery

  • 1. Everything You Need to Know In Order to Start Using jQuery A Play in Three Acts by Dave Ross Suburban Chicago PHP & Web Development Meetup July 30, 2008
  • 2. What is jQuery? Remember when you tried learning Javascript ten years ago and you wanted to hunt down the person who invented it and beat their head in with a rusty crowbar? Forget that. Seriously. That stuff ain't healthy.
  • 3. What is jQuery? jQuery is a Javascript library for manipulating elements on a page. jQuery takes care of cross-browser issues. jQuery is shorter and easier to read than old- fashioned DOM scripting. jQuery comes with cool effects, and you can download more.
  • 4. Why use jQuery? If you use jQuery, you will become a Web 2.0™ superstar. You will be able to found a startup, get funded by Y Combinator, attend all the hottest parties at Google, and Leo Laporte will drop your name incessantly.
  • 5. Everything you need to $('#example').fadeOut(); #example...where have I seen that before? Oh yeah, it's a CSS selector! You can use pretty much any CSS selector as a parameter in $(). For example: $('div.sidebar'); $('table#salaries'); $('div.sidebar h1');
  • 6. Getting hungry already? You can probably skip the rest and read the docs at: http://docs.jquery.com There are tutorials at: http://docs.jquery.com/Tutorials Still here?
  • 7. Everything you need to $() returns a set of elements that match that CSS selector. Anything you tack on at the end is applied to all of them. $('p').slideUp() makes every paragraph disappear. Not cool! Don't do that. $('#example').fadeOut() only effects one element, the one with id=”example”. It's much more specific.
  • 8. Let's see an example! <script src=”/path/to/jquery-1.2.3.js” type=”text/javascript” /> <script type=”text/javascript”> function clickHandler()‫‏‬ { $('#example').fadeOut(); } </script> <div id=”example” onclick=”clickHandler();”>test</div>
  • 9. jQuery UI $('#example').fadeOut(); Why do I keep using that example? That's what you're going to be using jQuery for most of the time, fading things in & out like you think you're Google or something. fadeOut() is one of the jQuery Effects (show, hide, fade, and slide). Also, there are fancier animations in the jQuery UI library @ ui.jquery.com – stuff like “split the div into 36 pieces and send each of them flying in a different direction”.
  • 10. Events jQuery makes working with events much easier. Events are things like ready (when the page is fully loaded), click, focus, keydown, resize, submit, etc. $('#example').focus() gives the #example element focus. $('#example').focus(focusHandler) says to call focusHandler() when #example gets focus. $(document).ready(readyHandler) says to call readyHandler() when the page is done loading.
  • 11. Closures While we're talking about events, this would be a good time to discuss closures. Some functions expect you to pass them the name of another function to call later. You can use a closure to define that function right then & there. Instead of $('#example').focus(focusHandler), with focusHandler() defined somewhere else, you can say: $('#example').focus( function() { // Everything focusHandler would do // can be done here, not off in some // other file somewhere alert('Hello world!'); });
  • 12. Cliff's Notes The most important things I hope you learned: $('some CSS selector')‫‏‬ http://docs.jquery.com

Editor's Notes