SlideShare a Scribd company logo
A BRIEF INTRO

    Madgex
WHAT IS IT?
WHAT IS IT?

•AJavaScript library with the philosophy "Writing JavaScript
code should be fun"
WHAT IS IT?

•A JavaScript library with the philosophy "Writing JavaScript
 code should be fun"
• Simplifies   stuff & adds common functionality
WHAT IS IT?

•A JavaScript library with the philosophy "Writing JavaScript
 code should be fun"
• Simplifies   stuff & adds common functionality
• Removessome cross-browser headaches (events/AJAX/
 window.onload)
WHAT IS IT?

•A JavaScript library with the philosophy "Writing JavaScript
 code should be fun"
• Simplifies   stuff & adds common functionality
• Removessome cross-browser headaches (events/
 window.onload)
• Pretty   small at 19KB minified & gzipped
HOW DO YOU USE IT?

• "Find   stuff & do stuff to it"
HOW DO YOU USE IT?

• "Find   stuff & do stuff to it"
• Finding   stuff is based around CSS(1-3) selectors & XPath
HOW DO YOU USE IT?

• "Find   stuff & do stuff to it"
• Finding   stuff is based around CSS(1-3) selectors & XPath
• Threemain 'doing' categories based around: manipulation,
 returning a value & modifying
HOW DO YOU USE IT?

• "Find   stuff & do stuff to it"
• Finding   stuff is based around CSS(1-3) selectors & XPath
• Threemain 'doing' categories based around: manipulation,
 returning a value & modifying
• Chaining    methods together - makes it look weird
ME
 H O W E!
S    CO D
T HE
SELECTING
jQuery('div.panel')
All divs with class=“panel”
$('p#intro')
The paragraph with id=“intro”
$('div#content
a:visible')
All visible links inside the div with id=“content”
$('input[name=email]')
All input fields with name=“email”
$('table.orders
tr:odd')
“odd” numbered rows in a table with class “orders”
MANIPULATION
$('div#primary').width(300);
Set the width of div id=“primary” to 300 px.
$('p').css('line‐height',
'1.8em');
Apply a line-height of 1.8em to all paragraphs.
$('li:odd').css({color:
'white',
backgroundColor:
'black'});
Apply two CSS rules to every other list item; note that the css() function can take an object
instead of two strings.
var
div
=
$('<div>Some
text</div>').addClass('inserted').attr('id',
'foo');
div.appendTo(document.body);
Create a snippet of HTML, add some attributes then add it to the document.
RESULT SET MANIPULATION
$('div').not('[id]')
Returns divs that do not have an id attribute.
$('h2').parent()
Returns all elements that are direct parents of an h2.
$('blockquote').children()
Returns all elements that are children of a blockquote.
$('p').eq(4).next()
Find the fifth paragraph on the page, then find the next element (its direct sibling to the right).
$('input:text:first').parents('form')
Find the form parent of the first input type=“text” field on the page. The optional argument to parents()
is another selector.
EVENTS
$('p').click(function()
{




$(this).css('background‐color',
'red');
});
Set up paragraphs so that when you click them they turn red.
$('a').hover(function()
{




$(this).css('background‐color',
'orange');
},
function()
{




$(this).css('background‐color',
'white');
});
hover() is a shortcut for setting up two functions that run onmouseover and
onmouseout.
AJAX
$.ajax({


type:
"POST",


data:
“name=Dave&location=Brighton”


url:
"/getusers",


success:
function(data){





console.log(‘data
from
server:
’,
data);


}
});
ANIMATION




$("p").click(function
()
{






$(this).fadeOut("slow");




});




$("div#clickme").click(function
()
{






$(this).animate({









width:
"70%",








opacity:
0.4,








marginLeft:
"20px",








fontSize:
"3em",









borderWidth:
"10px"






},
1500
);




});
EXAMPLE
LINKY LINKS

• http://jquery.com   & http://docs.jquery.com
• http://docs.jquery.com/discussion

• http://api.jquery.com   - Interactive API browser & AIR
 download
• jQuery for JavaScript developers - http://tinyurl.com/
 jq4jsdevs

More Related Content

PDF
jQuery Essentials
PDF
jQuery for beginners
PDF
Stack Overflow Austin - jQuery for Developers
ODP
Introduction to jQuery
PPTX
Unobtrusive javascript with jQuery
PPTX
PDF
jQuery - 10 Time-Savers You (Maybe) Don't Know
PPTX
Jquery-overview
jQuery Essentials
jQuery for beginners
Stack Overflow Austin - jQuery for Developers
Introduction to jQuery
Unobtrusive javascript with jQuery
jQuery - 10 Time-Savers You (Maybe) Don't Know
Jquery-overview

What's hot (20)

PDF
Introduction to jQuery (Ajax Exp 2007)
PDF
jQuery Essentials
PDF
Advanced jQuery (Ajax Exp 2007)
PPTX
Jquery introduction
KEY
JQuery: JavaScript Library of the Future
PPT
PPTX
jQuery
ODP
Drupal Best Practices
PDF
Creative Web 2 - CSS
PDF
jQuery Introduction
PDF
Introduction to jQuery (Ajax Exp 2006)
PDF
JavaScript Library Overview (Ajax Exp West 2007)
PDF
Learning jQuery made exciting in an interactive session by one of our team me...
PDF
Introduction to jQuery
PPT
jQuery Learning
PDF
Jquery, write less do more by weLaika
PPTX
Introduction to jQuery - The basics
PPT
PDF
Learn css3
Introduction to jQuery (Ajax Exp 2007)
jQuery Essentials
Advanced jQuery (Ajax Exp 2007)
Jquery introduction
JQuery: JavaScript Library of the Future
jQuery
Drupal Best Practices
Creative Web 2 - CSS
jQuery Introduction
Introduction to jQuery (Ajax Exp 2006)
JavaScript Library Overview (Ajax Exp West 2007)
Learning jQuery made exciting in an interactive session by one of our team me...
Introduction to jQuery
jQuery Learning
Jquery, write less do more by weLaika
Introduction to jQuery - The basics
Learn css3
Ad

Viewers also liked (7)

PPTX
Everyday spaces
PDF
King Daddy - Wedding Presentation
DOCX
Adult cardiac surgery
 
PPT
Getting data "hackday ready".
KEY
Contrary to popular belief
PPT
Paper prototyping: early stage feedback on ux
PPT
How we got here.
Everyday spaces
King Daddy - Wedding Presentation
Adult cardiac surgery
 
Getting data "hackday ready".
Contrary to popular belief
Paper prototyping: early stage feedback on ux
How we got here.
Ad

Similar to An introduction to jQuery (20)

PPTX
Iniciando com jquery
PPT
J Query Public
PPTX
JQuery
PDF
fuser interface-development-using-jquery
PDF
jQuery Rescue Adventure
PPTX
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
PPTX
SharePointfest Denver - A jQuery Primer for SharePoint
PPTX
Jquery
PPTX
JavaScript!
PPTX
J query1
PPT
Jquery presentation
PPTX
SEF2013 - A jQuery Primer for SharePoint
PDF
bcgr3-jquery
PDF
bcgr3-jquery
PDF
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
PDF
Caffeinated Style Sheets
KEY
User Interface Development with jQuery
PDF
Jquery In Rails
PPTX
Jquery fundamentals
Iniciando com jquery
J Query Public
JQuery
fuser interface-development-using-jquery
jQuery Rescue Adventure
How I Learned to Stop Worrying and Love jQuery (Jan 2013)
SharePointfest Denver - A jQuery Primer for SharePoint
Jquery
JavaScript!
J query1
Jquery presentation
SEF2013 - A jQuery Primer for SharePoint
bcgr3-jquery
bcgr3-jquery
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Caffeinated Style Sheets
User Interface Development with jQuery
Jquery In Rails
Jquery fundamentals

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced IT Governance
Review of recent advances in non-invasive hemoglobin estimation
madgavkar20181017ppt McKinsey Presentation.pdf
Modernizing your data center with Dell and AMD
NewMind AI Weekly Chronicles - August'25 Week I
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
20250228 LYD VKU AI Blended-Learning.pptx
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced IT Governance

An introduction to jQuery

Editor's Notes

  • #2: I&amp;#x2019;ve been working with jQuery for a little while now. It seems to be gaining more mainstream momentum than other JS libraries, and MS is providing Intelisense for it in VS2008.\nIt&apos;s only fairly recently been given the green light for project work so Jane asked me to do a little ramble on it to introduce you if your not already aquainted.\n
  • #3: \n
  • #4: Most of the time it is! In the past JavaScript could be, we&amp;#x2019;ll say, fiddly. Flip side is jQuery - it&amp;#x2019;s like sprinkling magic dust on your HTML.\nIt has a nice low barrier to entry - it must do - I&amp;#x2019;m using it.\nYes it&amp;#x2019;s a library, potentially not as fast as pure old school JS.\n
  • #5: \n
  • #6: Easy DOM traversal, you can find elements and more around easily\nAdds easy manipulation of elements(moving/altering content)\nEvents, Ajax &amp; Animations\n
  • #7: jQuery provides simple, unified handling of ajax &amp; events (clicks, mouseovers, keypress&amp;#x2019; etc.)\nIE&amp;#x2019;s AJAX support is different to the W3C method - ActiveX vs. XMLHTTPRequest.\nConsistent DOM ready - essential for unobtrusive JS\n\n
  • #8: \n
  • #9: jQuery&amp;#x2019;s mantra is &quot;Find stuff &amp; do stuff to it&quot;\n\n
  • #10: Uses CSS1-3, and some customs like :visible, :odd\n
  • #11: Manipulate all of the matched elements.\nReturn a value from the first matched object.\nmodify the selection itself.\n
  • #12: A jQuery aim is to &amp;#x201C;change the way you write JavaScript&amp;#x201D; - this may put you off, but the reason they say it is because of it&amp;#x2019;s powerful chaining ability - you can chain one method onto another passing the results of the current method on to the next.\n
  • #13: Tom says enough chat - he wants code!\n
  • #14: I&amp;#x2019;m going to quickly show some slides of code &amp; then some examples in Firebug.\n
  • #15: \n
  • #16: \n
  • #17: \n
  • #18: \n
  • #19: \n
  • #20: \n
  • #21: \n