SlideShare une entreprise Scribd logo
1  sur  27
Unit 2: jQuery
Lesson 3: Abstraction
October 2, 2013
Lesson 3: Abstraction
Introduction
to jQuery

Syntax and
Structure

Abstraction

Pictures,
Video, and
Media

Lesson 1

Lesson 2

Lesson 3

Lesson 4

Learning to
Use CSS

Introduction
to CSS

Search
Engine
Optimization

HTML and
Forms

Lesson 8

Lesson 7

Lesson 6

Lesson 5

Separation of
Concerns

3 Ways to
Use CSS

Reusing
Code

Launching
Your Own
Website

Lesson 9

Lesson 10

Lesson 11

Lesson 12

2
Recap from last time (I)
• jQuery has three main benefits over Javascript:
1) Fewer mistakes
2) Less code
3) Faster to learn
• jQuery code has a consistent structure
jQuery code
$(document).ready(function() {

$(pageElement).someEvent(function() {

$(thingToChange).someEffect();
});
});
3
Recap from last time (II)
• jQuery has three main benefits over Javascript:
1) Fewer mistakes
2) Less code
3) Faster to learn
• jQuery code has a consistent structure
jQuery code
$(document).ready(function() {

$(pageElement).someEvent(function() {

$(thingToChange).someEffect();

English translation
When the document is ready, do the
following:
When someEvent happens to pageElement,
do the following:
Make someEffect happen to thingToChange

});
});
4
Recap from last time (III)
jQuery code
$(document).ready(function() {

$('a').click(function() {
alert('hello');
});
});

English translation
When the document is ready, do the
following:
When the HTML element with an <a> tag
is clicked, do the following:
Send an alert that says “hello”

5
Recap from last time (IV)
jQuery code
$(document).ready(function() {

$('a').click(function() {
alert('hello');
});
});

English translation
When the document is ready, do the
following:
When the HTML element with an <a> tag
is clicked, do the following:
Send an alert that says “hello”

Original page

Result after clicking

6
jQuery vs. Javascript (I)
• We’ve mentioned Javascript a few times already, but let’s better
understand how it relates to jQuery
Javascript
• Javascript is a programming
language

jQuery
• jQuery is NOT a programming
language

7
jQuery vs. Javascript (II)
• We’ve mentioned Javascript a few times already, but let’s better
understand how it relates to jQuery
Javascript

jQuery

• Javascript is a programming
language

• jQuery is NOT a programming
language

• Can be used to create all
kinds of cool features

• Can only produce some of the
features we might need

8
jQuery vs. Javascript (III)
• We’ve mentioned Javascript a few times already, but let’s better
understand how it relates to jQuery
Javascript

jQuery

• Javascript is a programming
language

• jQuery is NOT a programming
language

• Can be used to create all
kinds of cool features

• Can only produce some of the
features we might need

• More complicated

• Easier to learn

9
jQuery vs. Javascript (IV)
• We’ve mentioned Javascript a few times already, but let’s better
understand how it relates to jQuery
Javascript

jQuery

• Javascript is a programming
language

• jQuery is NOT a programming
language

• Can be used to create all
kinds of cool features

• Can only produce some of the
features we might need

• More complicated

• Easier to learn

So how does jQuery relate to Javascript?
jQuery is an abstraction of Javascript.
10
What is an abstraction?
• An abstraction is a system that hides the complex parts so that only
the important details can be seen
• It is a core concept in computer science because computers are
fundamentally very complex machines
• Abstractions allow us to interact with computers on a much simpler
level

One of the earliest computers (from 1946)
11
Even watching a video online is a very
complicated process

12
A real life example of an abstraction (I)
• It’s pretty easy to drive a car – there are really only 3 things you
need to know:
1. Step on the gas pedal / brake to accelerate / slow down
2. Rotate the steering wheel to turn the car

3. Use the gear stick to switch between forward and backward

13
A real life example of an abstraction (II)
• However, a car is actually a very complicated machine
• Every car is built from thousands of individual parts that each
serve a distinct purpose

14
A real life example of an abstraction (III)
• What happens when we step on the gas pedal?
• Well, a lot of things happen involving the pedal, throttle valve, and
something called an ECU…The truth is most of us don’t know how
a gas pedal works!
• But that’s ok – the details are not important. All we need to know is
the end result – the car will accelerate!

15
A real life example of an abstraction (IV)
• The gas pedal is an abstraction – we use the abstraction of the
gas pedal to control the engine speed
• We don’t need to understand the details to know how to operate it

• Similarly, the steering wheel is an abstraction for the direction of
the front wheels and the gear stick is an abstraction for the car’s
direction of travel

16
Like the gas pedal, jQuery is also an abstraction
• jQuery is an abstraction for Javascript
• jQuery provides us with an easier way to use Javascript without
needing to understand the details of how Javascript works

• That’s why it’s one of the easiest ways to add movement to a
webpage

17
Another example of jQuery vs. Javascript (I)
• Let’s look at another example to see how jQuery makes our lives much
easier. If we want to make something disappear, we can do this in
either jQuery or Javascript.

Original page

Text disappears almost
immediately

18
Another example of jQuery vs. Javascript (II)
• As you can see, the Javascript version is far more complicated!
jQuery:

Javascript:

$(document).ready(function() {
$(‘#clickedElement’).click(function() {
$(‘#fadedElement’).fadeOut();
});
});
function fadeThisElement(elm) {
for (var i=10; i>0; i--) {
var opacity = i/10;
setTimeout( function(opacity) {
elm.setStyle(“-moz-opacity”, opacity);
elm.setStyle(“opacity”, opacity);
elm.setStyle(“filter”, “alpha(opacity=“ + (opacity*100).toString() );
}, 100;
}
}
window.onload = function() {
document.getElementsById(“clickedElement”).onclick = function() {
fadeThisElement(document.getElementById(‘fadedElement’));
}
}

19
Another example of jQuery vs. Javascript (III)
• jQuery provides us with an abstraction for working with Javascript
without worrying about the implementation details
• It’s much easier to understand!
jQuery code

English translation

$(document).ready(function() {

$(‘#clickedElement’).click(function() {

$(‘#fadedElement’).fadeOut();
});
});
20
Another example of jQuery vs. Javascript (IV)
• jQuery provides us with an abstraction for working with Javascript
without worrying about the implementation details
• It’s much easier to understand!
jQuery code
$(document).ready(function() {

English translation
Select the document. When it is ready
do the following:

$(‘#clickedElement’).click(function() {

$(‘#fadedElement’).fadeOut();
});
});
21
Another example of jQuery vs. Javascript (V)
• jQuery provides us with an abstraction for working with Javascript
without worrying about the implementation details
• It’s much easier to understand!
jQuery code
$(document).ready(function() {

$(‘#clickedElement’).click(function() {

English translation
Select the document. When it is ready
do the following:

Select the element with id named
clickedElement. If clicked, do the following:

$(‘#fadedElement’).fadeOut();
});
});
22
Another example of jQuery vs. Javascript (VI)
• jQuery provides us with an abstraction for working with Javascript
without worrying about the implementation details
• It’s much easier to understand!
jQuery code
$(document).ready(function() {

$(‘#clickedElement’).click(function() {

$(‘#fadedElement’).fadeOut();
});

English translation
Select the document. When it is ready
do the following:

Select the element with id named
clickedElement. If clicked, do the following:
Select the element with id named
fadedElement and make it fade out

});
23
Summary (I)
• Abstraction is the process of hiding the complex parts of a system
so that only the important details can be seen
• A gas pedal is an example of an abstraction – it lets us control the
speed of the car without needing to understand what happens under
the hood

24
Summary (II)
• Similarly, jQuery is an abstraction of Javascript – it lets us use
Javascript without having to understand the implementation details

jQuery code
$(document).ready(function() {

$(‘#clickedElement’).click(function() {

$(‘#fadedElement’).fadeOut();
});
});
25
Summary (III)
• Similarly, jQuery is an abstraction of Javascript – it lets us use
Javascript without having to understand the implementation details

jQuery code
$(document).ready(function() {

$(‘#clickedElement’).click(function() {

$(‘#fadedElement’).fadeOut();
});

English translation
Select the document. When it is ready
do the following:

Select the element with id named
clickedElement. If clicked, do the following:
Select the element with id named
fadedElement and make it fade out

});
26
What to do on your own
1. Go to URL to complete the Codecademy course online

2. Do the practice set on the material learned

1. Take the follow-up quiz to test your understanding

27

Contenu connexe

Tendances

jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
Difference between java script and jquery
Difference between java script and jqueryDifference between java script and jquery
Difference between java script and jqueryUmar Ali
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introductionTomi Juhola
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQueryAngel Ruiz
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingDoug Neiner
 
High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptLeonardo Borges
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginnersIsfand yar Khan
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009Remy Sharp
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponentsMartin Hochel
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryGunjan Kumar
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVCThomas Reynolds
 
Devdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for DevelopersDevdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for Developerscody lindley
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');mikehostetler
 

Tendances (20)

jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
Difference between java script and jquery
Difference between java script and jqueryDifference between java script and jquery
Difference between java script and jquery
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Jquery
JqueryJquery
Jquery
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
Discover React
Discover ReactDiscover React
Discover React
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScript
 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginners
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
 
jQuery quick tips
jQuery quick tipsjQuery quick tips
jQuery quick tips
 
Devdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for DevelopersDevdays Seattle jQuery Intro for Developers
Devdays Seattle jQuery Intro for Developers
 
jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');jQuery('#knowledge').appendTo('#you');
jQuery('#knowledge').appendTo('#you');
 

Similaire à Lesson 203 18 sep13-1500-ay

Lesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ayLesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ayCodecademy Ren
 
Top 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | EdurekaTop 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | EdurekaEdureka!
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupalBlackCatWeb
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive OverviewMohamed Loey
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesTeamstudio
 
J query presentation
J query presentationJ query presentation
J query presentationakanksha17
 
J query presentation
J query presentationJ query presentation
J query presentationsawarkar17
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaoladrewz lin
 
Lesson 207 19 oct13-1500-ay
Lesson 207 19 oct13-1500-ayLesson 207 19 oct13-1500-ay
Lesson 207 19 oct13-1500-ayCodecademy Ren
 
JQUERY TUTORIALS
JQUERY TUTORIALSJQUERY TUTORIALS
JQUERY TUTORIALSMoize Roxas
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Torontodmethvin
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with ReduxFITC
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
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
 
Lesson 201 14 sep13-1500-ay
Lesson 201 14 sep13-1500-ayLesson 201 14 sep13-1500-ay
Lesson 201 14 sep13-1500-ayCodecademy Ren
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - IntroductionWebStackAcademy
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSTom Borger
 

Similaire à Lesson 203 18 sep13-1500-ay (20)

Lesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ayLesson 202 02 oct13-1800-ay
Lesson 202 02 oct13-1800-ay
 
Top 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | EdurekaTop 45 jQuery Interview Questions and Answers | Edureka
Top 45 jQuery Interview Questions and Answers | Edureka
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
 
JQuery Comprehensive Overview
JQuery Comprehensive OverviewJQuery Comprehensive Overview
JQuery Comprehensive Overview
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
 
J query presentation
J query presentationJ query presentation
J query presentation
 
J query presentation
J query presentationJ query presentation
J query presentation
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
Lesson 207 19 oct13-1500-ay
Lesson 207 19 oct13-1500-ayLesson 207 19 oct13-1500-ay
Lesson 207 19 oct13-1500-ay
 
JQUERY TUTORIALS
JQUERY TUTORIALSJQUERY TUTORIALS
JQUERY TUTORIALS
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Toronto
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
 
Jquery
JqueryJquery
Jquery
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
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
 
Lesson 201 14 sep13-1500-ay
Lesson 201 14 sep13-1500-ayLesson 201 14 sep13-1500-ay
Lesson 201 14 sep13-1500-ay
 
jQuery - Chapter 1 - Introduction
 jQuery - Chapter 1 - Introduction jQuery - Chapter 1 - Introduction
jQuery - Chapter 1 - Introduction
 
Integrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMSIntegrating AngularJS into the Campus CMS
Integrating AngularJS into the Campus CMS
 

Plus de Codecademy Ren

Lesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ayLesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ayCodecademy Ren
 
Lesson 303 05 jan14-1500-ay
Lesson 303 05 jan14-1500-ayLesson 303 05 jan14-1500-ay
Lesson 303 05 jan14-1500-ayCodecademy Ren
 
Lesson 301 26 nov13-1500-ay
Lesson 301 26 nov13-1500-ayLesson 301 26 nov13-1500-ay
Lesson 301 26 nov13-1500-ayCodecademy Ren
 
Lesson 302 05 jan14-1500-ay
Lesson 302 05 jan14-1500-ayLesson 302 05 jan14-1500-ay
Lesson 302 05 jan14-1500-ayCodecademy Ren
 
Lesson 206 11 oct13-1500-ay
Lesson 206 11 oct13-1500-ayLesson 206 11 oct13-1500-ay
Lesson 206 11 oct13-1500-ayCodecademy Ren
 
Lesson 205 07 oct13-1500-ay
Lesson 205 07 oct13-1500-ayLesson 205 07 oct13-1500-ay
Lesson 205 07 oct13-1500-ayCodecademy Ren
 
Lesson 204 03 oct13-1500-ay
Lesson 204 03 oct13-1500-ayLesson 204 03 oct13-1500-ay
Lesson 204 03 oct13-1500-ayCodecademy Ren
 
Lesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ayLesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ayCodecademy Ren
 
Lesson 112 24 aug13-2300-ay
Lesson 112 24 aug13-2300-ayLesson 112 24 aug13-2300-ay
Lesson 112 24 aug13-2300-ayCodecademy Ren
 
Lesson 109 23 aug13-1430-ay
Lesson 109 23 aug13-1430-ayLesson 109 23 aug13-1430-ay
Lesson 109 23 aug13-1430-ayCodecademy Ren
 
Lesson 108 23 aug13-1430-ay
Lesson 108 23 aug13-1430-ayLesson 108 23 aug13-1430-ay
Lesson 108 23 aug13-1430-ayCodecademy Ren
 
Lesson 107 23 aug13-1430-ay
Lesson 107 23 aug13-1430-ayLesson 107 23 aug13-1430-ay
Lesson 107 23 aug13-1430-ayCodecademy Ren
 
Lesson 106 23 aug13-1430-ay
Lesson 106 23 aug13-1430-ayLesson 106 23 aug13-1430-ay
Lesson 106 23 aug13-1430-ayCodecademy Ren
 
Lesson 105 23 aug13-1430-ay
Lesson 105 23 aug13-1430-ayLesson 105 23 aug13-1430-ay
Lesson 105 23 aug13-1430-ayCodecademy Ren
 
Lesson 102 23 aug13-1430-ay
Lesson 102 23 aug13-1430-ayLesson 102 23 aug13-1430-ay
Lesson 102 23 aug13-1430-ayCodecademy Ren
 
Lesson 101 23 aug13-1430-ay
Lesson 101 23 aug13-1430-ayLesson 101 23 aug13-1430-ay
Lesson 101 23 aug13-1430-ayCodecademy Ren
 
Lesson 102 25 aug13-2200-ay
Lesson 102 25 aug13-2200-ayLesson 102 25 aug13-2200-ay
Lesson 102 25 aug13-2200-ayCodecademy Ren
 
Lesson 103 23 aug13-1430-ay
Lesson 103 23 aug13-1430-ayLesson 103 23 aug13-1430-ay
Lesson 103 23 aug13-1430-ayCodecademy Ren
 
Lesson 104 23 aug13-1430-ay
Lesson 104 23 aug13-1430-ayLesson 104 23 aug13-1430-ay
Lesson 104 23 aug13-1430-ayCodecademy Ren
 
Lesson 111 24 aug13-1430-ay
Lesson 111 24 aug13-1430-ayLesson 111 24 aug13-1430-ay
Lesson 111 24 aug13-1430-ayCodecademy Ren
 

Plus de Codecademy Ren (20)

Lesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ayLesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ay
 
Lesson 303 05 jan14-1500-ay
Lesson 303 05 jan14-1500-ayLesson 303 05 jan14-1500-ay
Lesson 303 05 jan14-1500-ay
 
Lesson 301 26 nov13-1500-ay
Lesson 301 26 nov13-1500-ayLesson 301 26 nov13-1500-ay
Lesson 301 26 nov13-1500-ay
 
Lesson 302 05 jan14-1500-ay
Lesson 302 05 jan14-1500-ayLesson 302 05 jan14-1500-ay
Lesson 302 05 jan14-1500-ay
 
Lesson 206 11 oct13-1500-ay
Lesson 206 11 oct13-1500-ayLesson 206 11 oct13-1500-ay
Lesson 206 11 oct13-1500-ay
 
Lesson 205 07 oct13-1500-ay
Lesson 205 07 oct13-1500-ayLesson 205 07 oct13-1500-ay
Lesson 205 07 oct13-1500-ay
 
Lesson 204 03 oct13-1500-ay
Lesson 204 03 oct13-1500-ayLesson 204 03 oct13-1500-ay
Lesson 204 03 oct13-1500-ay
 
Lesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ayLesson 110 24 aug13-1400-ay
Lesson 110 24 aug13-1400-ay
 
Lesson 112 24 aug13-2300-ay
Lesson 112 24 aug13-2300-ayLesson 112 24 aug13-2300-ay
Lesson 112 24 aug13-2300-ay
 
Lesson 109 23 aug13-1430-ay
Lesson 109 23 aug13-1430-ayLesson 109 23 aug13-1430-ay
Lesson 109 23 aug13-1430-ay
 
Lesson 108 23 aug13-1430-ay
Lesson 108 23 aug13-1430-ayLesson 108 23 aug13-1430-ay
Lesson 108 23 aug13-1430-ay
 
Lesson 107 23 aug13-1430-ay
Lesson 107 23 aug13-1430-ayLesson 107 23 aug13-1430-ay
Lesson 107 23 aug13-1430-ay
 
Lesson 106 23 aug13-1430-ay
Lesson 106 23 aug13-1430-ayLesson 106 23 aug13-1430-ay
Lesson 106 23 aug13-1430-ay
 
Lesson 105 23 aug13-1430-ay
Lesson 105 23 aug13-1430-ayLesson 105 23 aug13-1430-ay
Lesson 105 23 aug13-1430-ay
 
Lesson 102 23 aug13-1430-ay
Lesson 102 23 aug13-1430-ayLesson 102 23 aug13-1430-ay
Lesson 102 23 aug13-1430-ay
 
Lesson 101 23 aug13-1430-ay
Lesson 101 23 aug13-1430-ayLesson 101 23 aug13-1430-ay
Lesson 101 23 aug13-1430-ay
 
Lesson 102 25 aug13-2200-ay
Lesson 102 25 aug13-2200-ayLesson 102 25 aug13-2200-ay
Lesson 102 25 aug13-2200-ay
 
Lesson 103 23 aug13-1430-ay
Lesson 103 23 aug13-1430-ayLesson 103 23 aug13-1430-ay
Lesson 103 23 aug13-1430-ay
 
Lesson 104 23 aug13-1430-ay
Lesson 104 23 aug13-1430-ayLesson 104 23 aug13-1430-ay
Lesson 104 23 aug13-1430-ay
 
Lesson 111 24 aug13-1430-ay
Lesson 111 24 aug13-1430-ayLesson 111 24 aug13-1430-ay
Lesson 111 24 aug13-1430-ay
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Dernier (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Lesson 203 18 sep13-1500-ay

  • 1. Unit 2: jQuery Lesson 3: Abstraction October 2, 2013
  • 2. Lesson 3: Abstraction Introduction to jQuery Syntax and Structure Abstraction Pictures, Video, and Media Lesson 1 Lesson 2 Lesson 3 Lesson 4 Learning to Use CSS Introduction to CSS Search Engine Optimization HTML and Forms Lesson 8 Lesson 7 Lesson 6 Lesson 5 Separation of Concerns 3 Ways to Use CSS Reusing Code Launching Your Own Website Lesson 9 Lesson 10 Lesson 11 Lesson 12 2
  • 3. Recap from last time (I) • jQuery has three main benefits over Javascript: 1) Fewer mistakes 2) Less code 3) Faster to learn • jQuery code has a consistent structure jQuery code $(document).ready(function() { $(pageElement).someEvent(function() { $(thingToChange).someEffect(); }); }); 3
  • 4. Recap from last time (II) • jQuery has three main benefits over Javascript: 1) Fewer mistakes 2) Less code 3) Faster to learn • jQuery code has a consistent structure jQuery code $(document).ready(function() { $(pageElement).someEvent(function() { $(thingToChange).someEffect(); English translation When the document is ready, do the following: When someEvent happens to pageElement, do the following: Make someEffect happen to thingToChange }); }); 4
  • 5. Recap from last time (III) jQuery code $(document).ready(function() { $('a').click(function() { alert('hello'); }); }); English translation When the document is ready, do the following: When the HTML element with an <a> tag is clicked, do the following: Send an alert that says “hello” 5
  • 6. Recap from last time (IV) jQuery code $(document).ready(function() { $('a').click(function() { alert('hello'); }); }); English translation When the document is ready, do the following: When the HTML element with an <a> tag is clicked, do the following: Send an alert that says “hello” Original page Result after clicking 6
  • 7. jQuery vs. Javascript (I) • We’ve mentioned Javascript a few times already, but let’s better understand how it relates to jQuery Javascript • Javascript is a programming language jQuery • jQuery is NOT a programming language 7
  • 8. jQuery vs. Javascript (II) • We’ve mentioned Javascript a few times already, but let’s better understand how it relates to jQuery Javascript jQuery • Javascript is a programming language • jQuery is NOT a programming language • Can be used to create all kinds of cool features • Can only produce some of the features we might need 8
  • 9. jQuery vs. Javascript (III) • We’ve mentioned Javascript a few times already, but let’s better understand how it relates to jQuery Javascript jQuery • Javascript is a programming language • jQuery is NOT a programming language • Can be used to create all kinds of cool features • Can only produce some of the features we might need • More complicated • Easier to learn 9
  • 10. jQuery vs. Javascript (IV) • We’ve mentioned Javascript a few times already, but let’s better understand how it relates to jQuery Javascript jQuery • Javascript is a programming language • jQuery is NOT a programming language • Can be used to create all kinds of cool features • Can only produce some of the features we might need • More complicated • Easier to learn So how does jQuery relate to Javascript? jQuery is an abstraction of Javascript. 10
  • 11. What is an abstraction? • An abstraction is a system that hides the complex parts so that only the important details can be seen • It is a core concept in computer science because computers are fundamentally very complex machines • Abstractions allow us to interact with computers on a much simpler level One of the earliest computers (from 1946) 11
  • 12. Even watching a video online is a very complicated process 12
  • 13. A real life example of an abstraction (I) • It’s pretty easy to drive a car – there are really only 3 things you need to know: 1. Step on the gas pedal / brake to accelerate / slow down 2. Rotate the steering wheel to turn the car 3. Use the gear stick to switch between forward and backward 13
  • 14. A real life example of an abstraction (II) • However, a car is actually a very complicated machine • Every car is built from thousands of individual parts that each serve a distinct purpose 14
  • 15. A real life example of an abstraction (III) • What happens when we step on the gas pedal? • Well, a lot of things happen involving the pedal, throttle valve, and something called an ECU…The truth is most of us don’t know how a gas pedal works! • But that’s ok – the details are not important. All we need to know is the end result – the car will accelerate! 15
  • 16. A real life example of an abstraction (IV) • The gas pedal is an abstraction – we use the abstraction of the gas pedal to control the engine speed • We don’t need to understand the details to know how to operate it • Similarly, the steering wheel is an abstraction for the direction of the front wheels and the gear stick is an abstraction for the car’s direction of travel 16
  • 17. Like the gas pedal, jQuery is also an abstraction • jQuery is an abstraction for Javascript • jQuery provides us with an easier way to use Javascript without needing to understand the details of how Javascript works • That’s why it’s one of the easiest ways to add movement to a webpage 17
  • 18. Another example of jQuery vs. Javascript (I) • Let’s look at another example to see how jQuery makes our lives much easier. If we want to make something disappear, we can do this in either jQuery or Javascript. Original page Text disappears almost immediately 18
  • 19. Another example of jQuery vs. Javascript (II) • As you can see, the Javascript version is far more complicated! jQuery: Javascript: $(document).ready(function() { $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); }); function fadeThisElement(elm) { for (var i=10; i>0; i--) { var opacity = i/10; setTimeout( function(opacity) { elm.setStyle(“-moz-opacity”, opacity); elm.setStyle(“opacity”, opacity); elm.setStyle(“filter”, “alpha(opacity=“ + (opacity*100).toString() ); }, 100; } } window.onload = function() { document.getElementsById(“clickedElement”).onclick = function() { fadeThisElement(document.getElementById(‘fadedElement’)); } } 19
  • 20. Another example of jQuery vs. Javascript (III) • jQuery provides us with an abstraction for working with Javascript without worrying about the implementation details • It’s much easier to understand! jQuery code English translation $(document).ready(function() { $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); }); 20
  • 21. Another example of jQuery vs. Javascript (IV) • jQuery provides us with an abstraction for working with Javascript without worrying about the implementation details • It’s much easier to understand! jQuery code $(document).ready(function() { English translation Select the document. When it is ready do the following: $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); }); 21
  • 22. Another example of jQuery vs. Javascript (V) • jQuery provides us with an abstraction for working with Javascript without worrying about the implementation details • It’s much easier to understand! jQuery code $(document).ready(function() { $(‘#clickedElement’).click(function() { English translation Select the document. When it is ready do the following: Select the element with id named clickedElement. If clicked, do the following: $(‘#fadedElement’).fadeOut(); }); }); 22
  • 23. Another example of jQuery vs. Javascript (VI) • jQuery provides us with an abstraction for working with Javascript without worrying about the implementation details • It’s much easier to understand! jQuery code $(document).ready(function() { $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); English translation Select the document. When it is ready do the following: Select the element with id named clickedElement. If clicked, do the following: Select the element with id named fadedElement and make it fade out }); 23
  • 24. Summary (I) • Abstraction is the process of hiding the complex parts of a system so that only the important details can be seen • A gas pedal is an example of an abstraction – it lets us control the speed of the car without needing to understand what happens under the hood 24
  • 25. Summary (II) • Similarly, jQuery is an abstraction of Javascript – it lets us use Javascript without having to understand the implementation details jQuery code $(document).ready(function() { $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); }); 25
  • 26. Summary (III) • Similarly, jQuery is an abstraction of Javascript – it lets us use Javascript without having to understand the implementation details jQuery code $(document).ready(function() { $(‘#clickedElement’).click(function() { $(‘#fadedElement’).fadeOut(); }); English translation Select the document. When it is ready do the following: Select the element with id named clickedElement. If clicked, do the following: Select the element with id named fadedElement and make it fade out }); 26
  • 27. What to do on your own 1. Go to URL to complete the Codecademy course online 2. Do the practice set on the material learned 1. Take the follow-up quiz to test your understanding 27