SlideShare uma empresa Scribd logo
1 de 62
Learning how to use jQuery #3
            YOSHIMURA Takahiro
            twitter: @yosshi
            yosshi@gmail.com
            http://www.greenplastic.net
            http://friendfeed.com/yosshi

            November 11, 2009
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha




Languages
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel
taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha
језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli
langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa
Bahasa valoda kalba limbă язык language
tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma
lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika
jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn
ngữ ‫ שפה‬мова ‫ ﺯﺑ# # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba
limbă язык language
for
Markup Engineer
Markup Engineer
• (X)HTML + CSS
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
• Design (not language anyway)
Markup Engineer
• (X)HTML + CSS
• CMS Templates (MovableType, WordPress
  and so on)
• JavaScript
• Accessibility, UI (not language anyway)
• Design (not language anyway)
• English
Review



         http://www.flickr.com/photos/themastershakesignal/173060038/
#1
#1
•   ready hundler
#1
•   ready hundler
•   selectors
#1
•   ready hundler
•   selectors
•   css
#1
•   ready hundler
•   selectors
•   css
•   effects
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
•   method chain
#1
•   ready hundler
•   selectors
•   css
•   effects
•   events
•   method chain
•   selector
#2
#2
•   Attributes - DOM
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
    •   Text - text(), text(val)
#2
•   Attributes - DOM
    •   Attr - attr(name), attr(properties), attr(key,
        value), attr(key, fn), removeAttr(name)
    •   Class - addClass(class), removeClass(class),
        toggleClass(class), toggleClass(class, switch)
    •   HTML - html(), html(val)
    •   Text - text(), text(val)
    •   Value - val(), val(val)
#2
•   Manipulation - DOM
#2
•   Manipulation - DOM
    •            - append(content), prepend(content),
        appendTo(content), prependTo(content)
#2
•   Manipulation - DOM
    •             - append(content), prepend(content),
        appendTo(content), prependTo(content)
    •            - after(content), before(content),
        insertAfter(content), insertBefore(content)
#2
•   Manipulation - DOM
    •             - append(content), prepend(content),
        appendTo(content), prependTo(content)
    •            - after(content), before(content),
        insertAfter(content), insertBefore(content)
    •                  - wrap(html), wrap(elem),
        wrapAll(html), wrapAll(elem),
        wrapInner(html), wrapInner(elem)
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)

    •      - empty(), remove()
#2
•   Manipulation - DOM
    •      - replaceWith(content), replaceAll(selector)

    •      - empty(), remove()

    •        - clone(), clone(true)
#3
#3

• today
#3

• today
• more events
#3

• today
• more events
• combination of events, css, effects,
  attributes and manipulation
#3

• today
• more events
• combination of events, css, effects,
  attributes and manipulation
• samples and demos
Events
Events
• ready(fn)
• click(fn)
• hover(over, out)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
• change(fn)
Events
• ready(fn)
• click(fn)
• hover(over, out)
• focus(fn)
• change(fn)
• keyup(fn)
Events - focus(fn)
$("input").focus(function() {
    $(this).next("span")
           .css('display', 'inline')
           .fadeOut(1000);
});
Events - change(fn)
$("select").change(function() {
    var str = "";
    $("select option:selected").each(function() {
        str += $(this).text() + " ";
    });
    $("div").text(str);
}).change();
Events - keyup(fn)
$("input").keyup(function() {
    $("div").text($(this).val());
}).keyup();




$(window).keyup(function(e) {
    var k = e.keyCode;
    $("div").text(e.keyCode);
    if (k == 13) $("div").append(' return');
});
Samples and Demos



              http://www.flickr.com/photos/neo_ii/4054300112/
Samples and Demos
Samples and Demos

• so-called “don’t click twice”
Samples and Demos

• so-called “don’t click twice”
• so-called “tab”
Samples and Demos

• so-called “don’t click twice”
• so-called “tab”
• so-called “roll over”
Samples and Demos
 • so-called “don’t click twice”
$("form").submit(function() {
    $("input[type=submit]").attr("disabled", "disabled");
});
Samples and Demos
 • so-called “tab”
// hide all content
$("#content > div").hide();

$("#nav li a").click(function() {
    // nav
    $("#nav li").removeClass("current");
    $(this).parent().addClass("current");
    // content
    $("#content > div").hide();
    var cpt = $(this).attr("href");
    $(cpt).show();
    return false;
});
Samples and Demos
  • so-called “roll over”
// preload
$("img.hover").each(function() {
    var preload = new Image;
    preload.src = this.src.replace(/^(.+)(.[a-z]+)$/, "$1_over$2");
});

// so-called roll over
$("img.hover").hover(
    function() {
        $(this).attr("src", function() { return $(this).attr('src').replace(/
^(.+)(.[a-z]+)$/, "$1_over$2"); } );
    },
    function() {
        $(this).attr("src", function() { return $(this).attr('src').replace(/
^(.+)_over(.[a-z]+)$/, "$1$2"); } );
    }
);
One More Thing



             http://www.flickr.com/photos/acaben/541334636/
http://www.flickr.com/photos/mikelowe/9696647/
Ajax



       http://www.flickr.com/photos/mikelowe/9696647/
Ajax
 • load(url, data, callback)
$("#trigger").click(function() {
    $("#wrapper").load("./sample.txt");
});
Ajax
 • jQuery.get(url, data, callback, type)
$("#trigger").click(function() {
    var num = $("select").val();
    $.get("./get.php",
          {id:num},
          function(data) {
              $("#wrapper").text(data);
          }
         );
});
thanks to
•   API reference
    •   http://docs.jquery.com/Main_Page
    •   http://semooh.jp/jquery/

•   jQuery Lesson Series
    •   http://woorkup.com/2009/10/05/jquery-lesson-series-introduction-to-
        selectors/
    •   http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with-
        html-forms/
    •   http://woorkup.com/2009/10/22/jquery-lessons-series-how-to-implement-
        animations-of-css-properties/
    •   http://woorkup.com/2009/11/06/jquery-lessons-series-manipulate-css-
        classes/
thanks to
•   Flickr
    •   http://www.flickr.com/photos/themastershakesignal/173060038/
    •   http://www.flickr.com/photos/neo_ii/4054300112/
    •   http://www.flickr.com/photos/acaben/541334636/
    •   http://www.flickr.com/photos/mikelowe/9696647/
    •   http://www.flickr.com/photos/jenosaur/4051305996/

•   Others
    •   http://www.alink.co.jp/tech/wiki/index.php?jQuery%2F
          %2Fsubmit                    2

    •   http://www.aozora.gr.jp/cards/000148/files/775_14942.html
http://www.flickr.com/photos/jenosaur/4051305996/

Mais conteúdo relacionado

Mais procurados

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
Php 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodPhp 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodJeremy Kendall
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentationguestcf600a
 
2018 PyCon Korea - Ring
2018 PyCon Korea - Ring2018 PyCon Korea - Ring
2018 PyCon Korea - RingYunWon Jeong
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmdiKlaus
 

Mais procurados (17)

Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Php 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the GoodPhp 102: Out with the Bad, In with the Good
Php 102: Out with the Bad, In with the Good
 
jQuery Loves You
jQuery Loves YoujQuery Loves You
jQuery Loves You
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
 
2018 PyCon Korea - Ring
2018 PyCon Korea - Ring2018 PyCon Korea - Ring
2018 PyCon Korea - Ring
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
 
jQuery
jQueryjQuery
jQuery
 

Semelhante a Learning How To Use Jquery #3

jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoFu Cheng
 
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
 
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
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjangoCalvin Cheng
 
J query introduction
J query introductionJ query introduction
J query introductionSMS_VietNam
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersJonathan Sharp
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuerycolinbdclark
 
Velocity tips and tricks
Velocity tips and tricksVelocity tips and tricks
Velocity tips and tricksdotCMS
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 

Semelhante a Learning How To Use Jquery #3 (20)

jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
J query
J queryJ query
J query
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
Jquery
JqueryJquery
Jquery
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
J query module1
J query module1J query module1
J query module1
 
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
 
Jquery
JqueryJquery
Jquery
 
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
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjango
 
Performance patterns
Performance patternsPerformance patterns
Performance patterns
 
J query introduction
J query introductionJ query introduction
J query introduction
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for Developers
 
The Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQueryThe Inclusive Web: hands-on with HTML5 and jQuery
The Inclusive Web: hands-on with HTML5 and jQuery
 
Velocity tips and tricks
Velocity tips and tricksVelocity tips and tricks
Velocity tips and tricks
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 

Último

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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Último (20)

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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 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?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Learning How To Use Jquery #3

  • 1. Learning how to use jQuery #3 YOSHIMURA Takahiro twitter: @yosshi yosshi@gmail.com http://www.greenplastic.net http://friendfeed.com/yosshi November 11, 2009
  • 2. tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha Languages језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ # # # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language tungumál teanga taal gjuha lingua bahasa iaith мова keel taal idioma lingua γλώσσα jezik språk idioma jazyk jezik lugha језик ภาษา wika jazyk sprog Sprache dil språk nyelv ॿॿॿॿ kieli langue език ngôn ngữ ‫ שפה‬мова ‫ ﺯﺑ# # # # ##ﺎﻥ‬język linguagem јазик lingwa Bahasa valoda kalba limbă язык language
  • 3. for
  • 6. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on)
  • 7. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript
  • 8. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway)
  • 9. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway) • Design (not language anyway)
  • 10. Markup Engineer • (X)HTML + CSS • CMS Templates (MovableType, WordPress and so on) • JavaScript • Accessibility, UI (not language anyway) • Design (not language anyway) • English
  • 11. Review http://www.flickr.com/photos/themastershakesignal/173060038/
  • 12. #1
  • 13. #1 • ready hundler
  • 14. #1 • ready hundler • selectors
  • 15. #1 • ready hundler • selectors • css
  • 16. #1 • ready hundler • selectors • css • effects
  • 17. #1 • ready hundler • selectors • css • effects • events
  • 18. #1 • ready hundler • selectors • css • effects • events • method chain
  • 19. #1 • ready hundler • selectors • css • effects • events • method chain • selector
  • 20. #2
  • 21. #2 • Attributes - DOM
  • 22. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name)
  • 23. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch)
  • 24. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val)
  • 25. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val) • Text - text(), text(val)
  • 26. #2 • Attributes - DOM • Attr - attr(name), attr(properties), attr(key, value), attr(key, fn), removeAttr(name) • Class - addClass(class), removeClass(class), toggleClass(class), toggleClass(class, switch) • HTML - html(), html(val) • Text - text(), text(val) • Value - val(), val(val)
  • 27. #2 • Manipulation - DOM
  • 28. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content)
  • 29. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content) • - after(content), before(content), insertAfter(content), insertBefore(content)
  • 30. #2 • Manipulation - DOM • - append(content), prepend(content), appendTo(content), prependTo(content) • - after(content), before(content), insertAfter(content), insertBefore(content) • - wrap(html), wrap(elem), wrapAll(html), wrapAll(elem), wrapInner(html), wrapInner(elem)
  • 31. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector)
  • 32. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector) • - empty(), remove()
  • 33. #2 • Manipulation - DOM • - replaceWith(content), replaceAll(selector) • - empty(), remove() • - clone(), clone(true)
  • 34. #3
  • 37. #3 • today • more events • combination of events, css, effects, attributes and manipulation
  • 38. #3 • today • more events • combination of events, css, effects, attributes and manipulation • samples and demos
  • 41. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn)
  • 42. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn) • change(fn)
  • 43. Events • ready(fn) • click(fn) • hover(over, out) • focus(fn) • change(fn) • keyup(fn)
  • 44. Events - focus(fn) $("input").focus(function() { $(this).next("span") .css('display', 'inline') .fadeOut(1000); });
  • 45. Events - change(fn) $("select").change(function() { var str = ""; $("select option:selected").each(function() { str += $(this).text() + " "; }); $("div").text(str); }).change();
  • 46. Events - keyup(fn) $("input").keyup(function() { $("div").text($(this).val()); }).keyup(); $(window).keyup(function(e) { var k = e.keyCode; $("div").text(e.keyCode); if (k == 13) $("div").append(' return'); });
  • 47. Samples and Demos http://www.flickr.com/photos/neo_ii/4054300112/
  • 49. Samples and Demos • so-called “don’t click twice”
  • 50. Samples and Demos • so-called “don’t click twice” • so-called “tab”
  • 51. Samples and Demos • so-called “don’t click twice” • so-called “tab” • so-called “roll over”
  • 52. Samples and Demos • so-called “don’t click twice” $("form").submit(function() { $("input[type=submit]").attr("disabled", "disabled"); });
  • 53. Samples and Demos • so-called “tab” // hide all content $("#content > div").hide(); $("#nav li a").click(function() { // nav $("#nav li").removeClass("current"); $(this).parent().addClass("current"); // content $("#content > div").hide(); var cpt = $(this).attr("href"); $(cpt).show(); return false; });
  • 54. Samples and Demos • so-called “roll over” // preload $("img.hover").each(function() { var preload = new Image; preload.src = this.src.replace(/^(.+)(.[a-z]+)$/, "$1_over$2"); }); // so-called roll over $("img.hover").hover( function() { $(this).attr("src", function() { return $(this).attr('src').replace(/ ^(.+)(.[a-z]+)$/, "$1_over$2"); } ); }, function() { $(this).attr("src", function() { return $(this).attr('src').replace(/ ^(.+)_over(.[a-z]+)$/, "$1$2"); } ); } );
  • 55. One More Thing http://www.flickr.com/photos/acaben/541334636/
  • 57. Ajax http://www.flickr.com/photos/mikelowe/9696647/
  • 58. Ajax • load(url, data, callback) $("#trigger").click(function() { $("#wrapper").load("./sample.txt"); });
  • 59. Ajax • jQuery.get(url, data, callback, type) $("#trigger").click(function() { var num = $("select").val(); $.get("./get.php", {id:num}, function(data) { $("#wrapper").text(data); } ); });
  • 60. thanks to • API reference • http://docs.jquery.com/Main_Page • http://semooh.jp/jquery/ • jQuery Lesson Series • http://woorkup.com/2009/10/05/jquery-lesson-series-introduction-to- selectors/ • http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with- html-forms/ • http://woorkup.com/2009/10/22/jquery-lessons-series-how-to-implement- animations-of-css-properties/ • http://woorkup.com/2009/11/06/jquery-lessons-series-manipulate-css- classes/
  • 61. thanks to • Flickr • http://www.flickr.com/photos/themastershakesignal/173060038/ • http://www.flickr.com/photos/neo_ii/4054300112/ • http://www.flickr.com/photos/acaben/541334636/ • http://www.flickr.com/photos/mikelowe/9696647/ • http://www.flickr.com/photos/jenosaur/4051305996/ • Others • http://www.alink.co.jp/tech/wiki/index.php?jQuery%2F %2Fsubmit 2 • http://www.aozora.gr.jp/cards/000148/files/775_14942.html