SlideShare a Scribd company logo
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/

More Related Content

What's hot

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
Jeremy 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 PHP
Jeremy Kendall
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
manugoel2003
 
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
Jeremy Kendall
 
jQuery Loves You
jQuery Loves YoujQuery Loves You
jQuery Loves You
DotNetMarche
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
Gil Fink
 
Jquery introduction
Jquery introductionJquery introduction
Jquery introduction
musrath mohammad
 
Your JavaScript Library
Your JavaScript LibraryYour JavaScript Library
Your JavaScript Library
Dmitry Baranovskiy
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
Simon Willison
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
QConLondon2008
 
jQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20PresentationjQuery%20on%20Rails%20Presentation
jQuery%20on%20Rails%20Presentation
guestcf600a
 
2018 PyCon Korea - Ring
2018 PyCon Korea - Ring2018 PyCon Korea - Ring
2018 PyCon Korea - Ring
YunWon Jeong
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
Remy Sharp
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
NexThoughts Technologies
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
Sudar Muthu
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
iKlaus
 
jQuery
jQueryjQuery

What's hot (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
 

Similar to 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
 
J query
J queryJ query
J query
Manav Prasad
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
Siva Arunachalam
 
Jquery
JqueryJquery
Jquery
Zoya Shaikh
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
Aaron Huang
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
Salvatore Fazio
 
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
Fu Cheng
 
J query module1
J query module1J query module1
J query module1
Srivatsan Krishnamachari
 
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
luckysb16
 
Jquery
JqueryJquery
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
Sean Burgess
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjango
Calvin Cheng
 
Performance patterns
Performance patternsPerformance patterns
Performance patterns
Stoyan Stefanov
 
J query introduction
J query introductionJ query introduction
J query introduction
SMS_VietNam
 
Stack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for DevelopersStack Overflow Austin - jQuery for Developers
Stack Overflow Austin - jQuery for Developers
Jonathan 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 jQuery
colinbdclark
 
Velocity tips and tricks
Velocity tips and tricksVelocity tips and tricks
Velocity tips and tricks
dotCMS
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
Quinton Sheppard
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
Stijn Van Minnebruggen
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
Cheng-Yi Yu
 

Similar to 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
 

Recently uploaded

Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 

Recently uploaded (20)

Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 

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