Intro to jQuery Alan Hecht http://alanhecht.me Jason Noble http://jasonnoble.org
Benefits Shallow learning curve, especially compared to other frameworks Easy to play with the DOM Easily add simple effects Cross-browser Compatibility jQuery handles browser caveats for you CSS3 Selectors Helpful Utilities
Benefits (cont.) jQuery UI Additional useful effects Advanced UI widgets UI Themes Plugins jQuery is easily extensible AJAX Widespread adoption
Firefox/Firebug Combo Firefox Firebug plugin Enable the script console in order to execute JavaScript
Let ’s get started curl -o jquery-1.5.1.min.js  http://code.jquery.com/jquery-1.5.1.min.js Go to jquery.com Click on  ‘Download( jQuery );’ Right click and select  ‘Save Page As…’
JavaScript Good to know for jQuery Functions JavaScript Object Notation (JSON)
JavaScript Functions Functions can be anonymous
JavaScript Functions Functions can be assigned to variables Variables can be called like a function
JavaScript Object Notation (JSON) Serialized JavaScript objects Collection of key-value pairs which represent an object Functions can be used as a value
JavaScript Object Notation Used to send data when making AJAX calls to the server
Document Object Model (DOM) Not specific to jQuery Standard way of representing objects in HTML that all browsers follow Hierarchal representation of your HTML Parent and children elements Each element can have an id and/or one or more class attributes
HTML File
HTML File - DOM
Element id Uniquely identifies the element <div id= “footer”>Thanks for visiting</div> That div ’s id is “footer”. Should only be one “footer” id.
Element class Multiple page elements can have the same type of class <p class= “warning”>Sorry….</p> <span class= “warning error”>Please try again</span> Classifies elements as a  “warning” Used to attach styles to elements Multiple classes on an element are seperated by spaces
CSS Selectors Originally designed to select elements on an HTML page to be styled jQuery uses CSS Selectors to create a set of one or more elements that will be the input to subsequent operations
CSS Selectors # selects an element via id div#headingId <div id= “headingId”> . selects an element via class div.headingClass <div class= “headingClass”> Can select just an id or class #headingId  .headingClass Can select an element, id, and a class div#headingId.headingClass
CSS Selectors Bare words selects HTML tags span <span> Can filter on attributes within HTML tags input[type = ‘button’] <input type=“button” />
CSS Selectors Space between words specifies ancestor relationship table td .  ‘>’ between words specifies parent/child relationship table>tr
jQuery Function Adding jQuery to a HTML page gives you access to the jQuery function jQuery jQuery(alert( ‘Hello’)) jQuery function is aliased as $, which is a common short-cut $ $(alert( ‘Hello’))
jQuery Selectors $( ‘<CSS Selector>’) or jQuery(‘CSS Selector>’) jQuery selectors can return an individual element or a set $('p#first')  - <p id=“first”> $(‘table>tr’)  - collection of <tr> elements
jQuery Statements selector action parameters jQuery( ‘p’) .css (‘color’, ‘blue’); $( ‘p’) .css (‘color’, ‘blue’); $( ‘p’) .css (‘font-size’, ‘35px’); $( ‘p’ ) .html ( ‘<a href=“/foo”>Home</a>’ );
jQuery Statements Statement actions can be chained Each action performed on all members of the set $('tr').css('font-size', '22pt').html( ‘Text’)
Play with tables
jQuery filters Filters certain elements $( ‘table tr: even ’)  => Rows 0, 2, 4, 6… $( ‘table tr: odd ’)  => Rows 1, 3, 5, 7… $( ‘table tr: first ’)  => First row $( ‘table tr: last ’)  => Last row $( ‘table tr: eq(3) ’)  => Third row
Play with tables (cont.) $('table tr:even').css('background-color', 'lightgrey') $('table tr:first').css('font-size', '64pt') $('table tr td').filter(function(index) { return index % 3 == 2; }).css('color', 'red') Many more selectors: http://api.jquery.com/category/selectors/
jQuery Effects jQuery library provides animation and effect calls, for example: fadeIn() fadeOut() show() hide() toggle() http://api.jquery.com/category/effects
Document Ready Event When our document is ready,  run our function <script> $(document).ready(function() { alert( ‘Welcome to my page!’); }); </script> Setup usually takes place in this event
$(selector).click(…) Executes code when a given div/button/etc is clicked Set up in the document ready event

More Related Content

ODP
Introduction to jQuery
PPTX
Jquery introduction
PPTX
jQuery Presentation
PPTX
PDF
Prototype & jQuery
PPTX
How to increase Performance of Web Application using JQuery
PDF
jQuery Essentials
Introduction to jQuery
Jquery introduction
jQuery Presentation
Prototype & jQuery
How to increase Performance of Web Application using JQuery
jQuery Essentials

What's hot (20)

PPT
PPT
A Short Introduction To jQuery
PDF
jQuery Essentials
PPTX
JavaScript and jQuery Basics
PDF
Learning jQuery in 30 minutes
PPTX
Jquery-overview
PDF
jQuery Loves Developers - Oredev 2009
PDF
jQuery for beginners
PPTX
Jquery Complete Presentation along with Javascript Basics
PPT
J Query Public
PDF
jQuery Features to Avoid
PDF
D3.js and SVG
PPTX
jQuery
PPTX
Unobtrusive javascript with jQuery
PDF
Introduction to jQuery
PPTX
jQuery
ODP
Drupal Best Practices
PPT
Don't Worry jQuery is very Easy:Learning Tips For jQuery
PPTX
PPTX
JQuery
A Short Introduction To jQuery
jQuery Essentials
JavaScript and jQuery Basics
Learning jQuery in 30 minutes
Jquery-overview
jQuery Loves Developers - Oredev 2009
jQuery for beginners
Jquery Complete Presentation along with Javascript Basics
J Query Public
jQuery Features to Avoid
D3.js and SVG
jQuery
Unobtrusive javascript with jQuery
Introduction to jQuery
jQuery
Drupal Best Practices
Don't Worry jQuery is very Easy:Learning Tips For jQuery
JQuery
Ad

Viewers also liked (8)

PPT
Integration and Acceptance Testing
PPTX
Some Observations from the Innovation Chasm
PPTX
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
PDF
Agile Acceptance testing with Fitnesse
PPTX
Writing Acceptance Tests Using Fitnesse
PPT
Fitnesse Testing Framework
PPT
Fitnesse - Acceptance testing
PPTX
WiKi Based Automation Testing: Fitness & DevOps
Integration and Acceptance Testing
Some Observations from the Innovation Chasm
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
Agile Acceptance testing with Fitnesse
Writing Acceptance Tests Using Fitnesse
Fitnesse Testing Framework
Fitnesse - Acceptance testing
WiKi Based Automation Testing: Fitness & DevOps
Ad

Similar to Intro to jQuery (20)

PPT
jQuery Intro
PDF
Learning jquery-in-30-minutes-1195942580702664-3
PPTX
Getting Started with jQuery
PPTX
Web technologies-course 11.pptx
PPTX
Introduction to JQuery
PPTX
J111111111111111111111111111111111111111query.pptx
PPTX
Iniciando com jquery
PDF
PPTX
jQuery
PPTX
Jquery
PPTX
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
PPTX
jQuery Presentasion
PPT
Jquery presentation
PPT
J query module1
PDF
Introducing jQuery
PDF
Introduction to jQuery
PPT
jQuery Fundamentals
PPT
J query intro_29thsep_alok
PPT
PPT
J query presentation
jQuery Intro
Learning jquery-in-30-minutes-1195942580702664-3
Getting Started with jQuery
Web technologies-course 11.pptx
Introduction to JQuery
J111111111111111111111111111111111111111query.pptx
Iniciando com jquery
jQuery
Jquery
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
jQuery Presentasion
Jquery presentation
J query module1
Introducing jQuery
Introduction to jQuery
jQuery Fundamentals
J query intro_29thsep_alok
J query presentation

More from Alan Hecht (6)

PPT
Intro to SPA using JavaScript & ASP.NET
PPT
Ruby Setup
PPT
Real World Rails Deployment
PPT
Rails review
PPT
jQuery and AJAX with Rails
PPTX
RSpec and Rails
Intro to SPA using JavaScript & ASP.NET
Ruby Setup
Real World Rails Deployment
Rails review
jQuery and AJAX with Rails
RSpec and Rails

Recently uploaded (20)

PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PPTX
SGT Report The Beast Plan and Cyberphysical Systems of Control
PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
PDF
Ensemble model-based arrhythmia classification with local interpretable model...
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PPTX
Presentation - Principles of Instructional Design.pptx
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
4 layer Arch & Reference Arch of IoT.pdf
PPTX
Internet of Everything -Basic concepts details
PDF
Advancing precision in air quality forecasting through machine learning integ...
PPTX
Module 1 Introduction to Web Programming .pptx
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
A symptom-driven medical diagnosis support model based on machine learning te...
Build automations faster and more reliably with UiPath ScreenPlay
Connector Corner: Transform Unstructured Documents with Agentic Automation
SGT Report The Beast Plan and Cyberphysical Systems of Control
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
Ensemble model-based arrhythmia classification with local interpretable model...
Rapid Prototyping: A lecture on prototyping techniques for interface design
Presentation - Principles of Instructional Design.pptx
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
4 layer Arch & Reference Arch of IoT.pdf
Internet of Everything -Basic concepts details
Advancing precision in air quality forecasting through machine learning integ...
Module 1 Introduction to Web Programming .pptx
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
Electrocardiogram sequences data analytics and classification using unsupervi...
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf

Intro to jQuery

  • 1. Intro to jQuery Alan Hecht http://alanhecht.me Jason Noble http://jasonnoble.org
  • 2. Benefits Shallow learning curve, especially compared to other frameworks Easy to play with the DOM Easily add simple effects Cross-browser Compatibility jQuery handles browser caveats for you CSS3 Selectors Helpful Utilities
  • 3. Benefits (cont.) jQuery UI Additional useful effects Advanced UI widgets UI Themes Plugins jQuery is easily extensible AJAX Widespread adoption
  • 4. Firefox/Firebug Combo Firefox Firebug plugin Enable the script console in order to execute JavaScript
  • 5. Let ’s get started curl -o jquery-1.5.1.min.js http://code.jquery.com/jquery-1.5.1.min.js Go to jquery.com Click on ‘Download( jQuery );’ Right click and select ‘Save Page As…’
  • 6. JavaScript Good to know for jQuery Functions JavaScript Object Notation (JSON)
  • 8. JavaScript Functions Functions can be assigned to variables Variables can be called like a function
  • 9. JavaScript Object Notation (JSON) Serialized JavaScript objects Collection of key-value pairs which represent an object Functions can be used as a value
  • 10. JavaScript Object Notation Used to send data when making AJAX calls to the server
  • 11. Document Object Model (DOM) Not specific to jQuery Standard way of representing objects in HTML that all browsers follow Hierarchal representation of your HTML Parent and children elements Each element can have an id and/or one or more class attributes
  • 13. HTML File - DOM
  • 14. Element id Uniquely identifies the element <div id= “footer”>Thanks for visiting</div> That div ’s id is “footer”. Should only be one “footer” id.
  • 15. Element class Multiple page elements can have the same type of class <p class= “warning”>Sorry….</p> <span class= “warning error”>Please try again</span> Classifies elements as a “warning” Used to attach styles to elements Multiple classes on an element are seperated by spaces
  • 16. CSS Selectors Originally designed to select elements on an HTML page to be styled jQuery uses CSS Selectors to create a set of one or more elements that will be the input to subsequent operations
  • 17. CSS Selectors # selects an element via id div#headingId <div id= “headingId”> . selects an element via class div.headingClass <div class= “headingClass”> Can select just an id or class #headingId .headingClass Can select an element, id, and a class div#headingId.headingClass
  • 18. CSS Selectors Bare words selects HTML tags span <span> Can filter on attributes within HTML tags input[type = ‘button’] <input type=“button” />
  • 19. CSS Selectors Space between words specifies ancestor relationship table td . ‘>’ between words specifies parent/child relationship table>tr
  • 20. jQuery Function Adding jQuery to a HTML page gives you access to the jQuery function jQuery jQuery(alert( ‘Hello’)) jQuery function is aliased as $, which is a common short-cut $ $(alert( ‘Hello’))
  • 21. jQuery Selectors $( ‘<CSS Selector>’) or jQuery(‘CSS Selector>’) jQuery selectors can return an individual element or a set $('p#first') - <p id=“first”> $(‘table>tr’) - collection of <tr> elements
  • 22. jQuery Statements selector action parameters jQuery( ‘p’) .css (‘color’, ‘blue’); $( ‘p’) .css (‘color’, ‘blue’); $( ‘p’) .css (‘font-size’, ‘35px’); $( ‘p’ ) .html ( ‘<a href=“/foo”>Home</a>’ );
  • 23. jQuery Statements Statement actions can be chained Each action performed on all members of the set $('tr').css('font-size', '22pt').html( ‘Text’)
  • 25. jQuery filters Filters certain elements $( ‘table tr: even ’) => Rows 0, 2, 4, 6… $( ‘table tr: odd ’) => Rows 1, 3, 5, 7… $( ‘table tr: first ’) => First row $( ‘table tr: last ’) => Last row $( ‘table tr: eq(3) ’) => Third row
  • 26. Play with tables (cont.) $('table tr:even').css('background-color', 'lightgrey') $('table tr:first').css('font-size', '64pt') $('table tr td').filter(function(index) { return index % 3 == 2; }).css('color', 'red') Many more selectors: http://api.jquery.com/category/selectors/
  • 27. jQuery Effects jQuery library provides animation and effect calls, for example: fadeIn() fadeOut() show() hide() toggle() http://api.jquery.com/category/effects
  • 28. Document Ready Event When our document is ready, run our function <script> $(document).ready(function() { alert( ‘Welcome to my page!’); }); </script> Setup usually takes place in this event
  • 29. $(selector).click(…) Executes code when a given div/button/etc is clicked Set up in the document ready event

Editor's Notes

  • #14: Body has two child elements, an h1 and a p. Body is the h1 ’s parent, h1 is a child of body