SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
#2




                    Day #1

     Creating the Wrapped Element Set

                  Wildan Maulana
           wildan.m@openthinklabs.com



         http://workshop.openthinklabs.com
This Presentation Cover
●   Selecting elements to be wrapped by jQuery
    using selectors
●   Creating and placing new HTML elements in
    the DOM
●   Manipulating the wrapped element set
Selecting elements for manipulation
●   Selectors Lab
Using basic CSS selectors
●   Selection by an element's ID, CSS class name, tag name, and the DOM
    hierarchy of the page elements
    ●    a → this selector matches all link (<a>) elements
    ●    #specialD → This selector matches element that have an id of specialID
    ●    .specialClass → This selector matches elements that have the class of
         specialClass
    ●    a#specialID .specialClass → this selector matches links with     an id of
         specialID and a class of specialClass
    ●    p a.specialClass → This selector matches link with a class of
         specialClass declared within <p> elements
        Use Selector labs for exercise using
        various basic CSS selectors ...               $("p a.specialClass")
Using child, container, and attribute selectors

<ul class="myList">                                    If we want to select the link to
 <li><a href="http://jquery.com">jQuery supports</a>
  <ul>                                                 the remote jQuery site basic
    <li><a href="css1">CSS1</a></li>                   css selector ul.myList li a will
    <li><a href="css2">CSS2</a></li>                   not work ..
    <li><a href="css3">CSS3</a></li>
    <li>Basic XPath</li>
  </ul>
 </li>                                                 The right approach is using
 <li>jQuery also supports                              child selectors :
  <ul>
    <li>Custom selectors</li>
    <li>Form selectors</li>
  </ul>
 </li>                                                   ul.myList > li > a
</ul>
Attribute Selectors
●   To select a link that points to an external site we
    can use :
                          <li><a href="http://jquery.com">jQuery supports</a>
                             <ul>
                               <li><a href="css1">CSS1</a></li>
    a[href^=http://]           <li><a href="css2">CSS2</a></li>
                               <li><a href="css3">CSS3</a></li>
                               <li>Basic XPath</li>
                             </ul>
                          </li>
More Attribute Selectors
●   To match an element that possesses a specific attribute, regardless of its value, we
    can use
     ●   form[method] : This matches any <form> element that has explicit method
         attribute
     ●   input[type=text] : This selector matches all input elements with a type of text
     ●   div[title^=my] : This selects elements with title attributes whose value begins with
         my
     ●   a[href$=.pdf] : This selects all links that reference PDF files
     ●   a[href*=jquery.com] : this selectow matches all <a> elements that reference
         jQuery site
Container selector
●    Container selector is useful if we want to
    select an element only if it contains some other
    element
    ●   li:has(a) → This selector matches all <li> elements
        that contain an <a> element
The basic Selectors Supported By jQuery
           Selector                                    Elements
*                             Matches any elements

E                             Matches all elements with tag name

EF                            Matches all elements with tag name F that are descendants of E

E>F                           Matches all elements with tag name F that are direct children of F

E+F                           Matches all elements F immediately preceded by sibling E

E~F                           Matches all elements F preceded by any sibling E

E:has(F)                      Matches all elements with tag name E that have at least one
                              descendent with tag name F

E.C                           Matches all elements E with class name C. Omitting E is the
                              same as *.C

E#I                           Matches elements E with id of I. Omitting E is the same as *#I

E[A]                          Matches all elements E with attribute A of any value

E[A=V]                        Matches all elements E with attribute A whose value is exactly V

E[A^=V]                       Matches all elements E with attribute A whose value begins with V

E[A$=V]                       Matches all elements E with attribute A whose value ends with V

E[A*=V]                       Matches all elements E with attribute A whose value contains V
Selecting by Position
●   Consider we want to select the first link on the page, or every other
    paragraph, or the list item of each list. JQuery supports mechanisms for
    achieving these specific selections.
●   For example :
    ●   a:first → this format of selector matches the first <a> element on the
        page
    ●   p:odd or p:even → this selector matches every odd or even paragraph
    ●   li:last-child → this selector matches the last child of parent elements
Advanced Positional selectors supported by jQuery
                   Selector                         Description

:first                             The first match of the page. Li a:first returns
                                   the first link also under a list item

:last                              The last match of the page. Li a:last returns
                                   the last link also under a list item

:first-child                       The first child element. li:first-child returns
                                   the first item of each child

:last-child                        The last child element. li:last-child returns
                                   the last item of each list

:only-child                        Returns all elements that have no siblings

:nth-child(n)                      The nth child element. li:nth-child(2) returns
                                   the second list item of each list

:nth-child(even|odd)               Even or odd children. li:nth-child(even)
                                   return the even children of each list

:nth-child(Xn+Y)                   The nth child element computed by the
                                   supplied formula.If Y is 0, it may be omitted.
                                   li:nth-child(3n) returns every third item,
                                   whereas li:nth-child(5n+1) return the item
                                   after every fifth element
Advanced Positional selectors supported by jQuery (2)


                 Selector                        Description
:even and :odd                      Even and odd matching elements
                                    page-wide . li:even return every even
                                    list item
:eq(n)                              Th nth matching element
:gt(n)                              Matching elements after (and
                                    excluding) the nth matching element
:lt(n)                              Matching elements before (and
                                    excluding) the nth matching element
Using Custom jQuery Selector

●   What if we want to select all check boxes that
    have been checked by the user ?
    ●   We can use jQuery custom selector : :checked
The jQuery custom filter selectors
        Selector                          Description
:animated           Selects elements that are currently under animated
                    control
:button             Selects any button (input[type=submit],
                    input[type=reset],input[type=reset],
                    input[type=button] or button)
:checkbox           Selects only check box elements
                    (input[type=checkbox])
:checked            Selects only check boxes or radio button that are
                    checked (supported by CSS)
:contains(foo)      Select only elements containing the text foo
:disabled           Select only form elements that are disabled in the
                    interface (supported by CSS)
:enabled            Selects only form elements that are enabled in the
                    interface (supported by CSS)
:file               Select all file elements (input[type=file])
The jQuery custom filter selectors -2
               Selector                                   Description

:header                   Selects only elements that are headers; for example (<h1>) through <h6>
                          elements
:hidden                   Selects only elements that are hidden

:image                    Select form image (input[type=image])

:input                    Select only forms elements (input, select, textarea, button)

:not(filter)              Negates the specified filter

:parent                   Selects only elements that have children (including text), but not an empty
                          elements
:password                 Selects only password elements (input[type=password])

:radio                    Selects only radio elements (input[type=radio])

:reset                    Selects reset buttons (input[type=reset]) or button[type=reset]

:selected                 Select option element that are selected

:submit                   Selects submit buttons (button[type=submit] or input[type=submit])

:text                     Select only text element (input[type=text])

:visible                  Selects only elements that are visible
The jQuery custom filter selectors

●   We can combine selector filters too :

    :checkbox:checked:enabled
Using the :not filter
●   input:not(:checkbox) → Select non-check-box
    <input> elements
●   We cannot :not filter and other filters to find
    selector :

    div :not(p:hidden) → invalid
    div p:not(:hidden) → valied
Jquery XPath Support
●   http://jquery.com/plugins/project/xpath

    TODO : Learn about xpath support later, after we finish the
    book … @_@
Generating new HTML
$("<div class='foo'>I have foo!</div><div>I don't</div>")
 .filter(".foo").click(function() {
   alert("I'm foo!");
 }).end().appendTo("#someParentDiv");
Managing the wrapped element set
Determining the size of the wrapped set


        $('#someDiv')
         .html('There are '+$('a').size()+' link(s) on this page.');




Remember that the set of jQuery wrapped elements acts a lot like an
array. !
Obtaining elements from the wrapped set

●   jQuery allows us to treat the wrapped set as a JavaScript array, so we can
    use simple array indexing to obtain any element in the wrapped list by
    position :
    ●   $('img[alt]')[0] or $('img[alt]').get(0) → get the first element in the set of all
        <img> elements with an alt attribute on the page
Slicing and Dicing the Wrapped Element Set




               Live Demo
Adding more element to the wrapped set

$('img[alt]').add('img[title]')
Adding more element to the wrapped set

●   Let's say that we want to apply a thick border to all <img> elements with alt attributes,
    and then apply a level of transparency to all <img> elements with either alt or title
    attributes


                $('img[alt]').addClass('thickBorder').add('img[title]')
                   .addClass('seeThrough')
Honing the Content of the Wrapped Set




            Live Demo
Q&A
Reference
●   JQuery in Action, Bear Bibeault, Yehuda Katz,
    Manning

Weitere ähnliche Inhalte

Was ist angesagt?

Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Abdullah Jan
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDrRajeshreeKhande
 
How to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingHow to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingSyed Faizan Hassan
 
Jquery selection optimisation
Jquery selection optimisationJquery selection optimisation
Jquery selection optimisationemmadey
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++NainaKhan28
 
Inner classes
Inner classesInner classes
Inner classesIcancode
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
Introduction to java programming
Introduction to java programmingIntroduction to java programming
Introduction to java programmingshinyduela
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Sagar Verma
 

Was ist angesagt? (17)

Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
 
Advanced JQuery Selectors
Advanced JQuery SelectorsAdvanced JQuery Selectors
Advanced JQuery Selectors
 
JQuery selectors
JQuery selectors JQuery selectors
JQuery selectors
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWT
 
Java2
Java2Java2
Java2
 
Event handling
Event handlingEvent handling
Event handling
 
How to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programmingHow to write you first class in c++ object oriented programming
How to write you first class in c++ object oriented programming
 
class c++
class c++class c++
class c++
 
Jquery selection optimisation
Jquery selection optimisationJquery selection optimisation
Jquery selection optimisation
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
Inner classes
Inner classesInner classes
Inner classes
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Class and object in C++ By Pawan Thakur
Class and object in C++ By Pawan ThakurClass and object in C++ By Pawan Thakur
Class and object in C++ By Pawan Thakur
 
Pj01 x-classes and objects
Pj01 x-classes and objectsPj01 x-classes and objects
Pj01 x-classes and objects
 
Event handling
Event handlingEvent handling
Event handling
 
Introduction to java programming
Introduction to java programmingIntroduction to java programming
Introduction to java programming
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
 

Andere mochten auch

Rectangular coordinate system
Rectangular coordinate systemRectangular coordinate system
Rectangular coordinate systemCathy Francisco
 
Linear equation in 2 variables
Linear equation in 2 variablesLinear equation in 2 variables
Linear equation in 2 variablesavb public school
 
Day 9 examples u4f13
Day 9 examples u4f13Day 9 examples u4f13
Day 9 examples u4f13jchartiersjsd
 
Cartesian coordinate plane
Cartesian coordinate planeCartesian coordinate plane
Cartesian coordinate planeElvie Hernandez
 
K to 12 - Grade 8 Math Learner Module
K to 12 - Grade 8 Math Learner ModuleK to 12 - Grade 8 Math Learner Module
K to 12 - Grade 8 Math Learner ModuleNico Granada
 
20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage ContentBarry Feldman
 

Andere mochten auch (8)

Exam outline j14
Exam outline j14Exam outline j14
Exam outline j14
 
Rectangular coordinate system
Rectangular coordinate systemRectangular coordinate system
Rectangular coordinate system
 
2.2 Set Operations
2.2 Set Operations2.2 Set Operations
2.2 Set Operations
 
Linear equation in 2 variables
Linear equation in 2 variablesLinear equation in 2 variables
Linear equation in 2 variables
 
Day 9 examples u4f13
Day 9 examples u4f13Day 9 examples u4f13
Day 9 examples u4f13
 
Cartesian coordinate plane
Cartesian coordinate planeCartesian coordinate plane
Cartesian coordinate plane
 
K to 12 - Grade 8 Math Learner Module
K to 12 - Grade 8 Math Learner ModuleK to 12 - Grade 8 Math Learner Module
K to 12 - Grade 8 Math Learner Module
 
20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content20 Ideas for your Website Homepage Content
20 Ideas for your Website Homepage Content
 

Ähnlich wie jQuery BootCamp : Creating the Wrapped Element Set

VISUAL CHEAT SHEET
VISUAL CHEAT SHEETVISUAL CHEAT SHEET
VISUAL CHEAT SHEETDanilo Sousa
 
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheetmaamir farooq
 
J query 17-visual-cheat-sheet1
J query 17-visual-cheat-sheet1J query 17-visual-cheat-sheet1
J query 17-visual-cheat-sheet1sdcasas
 
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)JQUERY EXAMPLE for Web Developer (Video Training Tutorial)
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)Kaml Sah
 
Jquery Example PPT
Jquery Example PPTJquery Example PPT
Jquery Example PPTKaml Sah
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfRAVALCHIRAG1
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerySeble Nigussie
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eGina Bullock
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eGina Bullock
 
TAppWeb Training Material
TAppWeb Training MaterialTAppWeb Training Material
TAppWeb Training MaterialArvie Bernal
 
TAppWeb Training Material
TAppWeb Training MaterialTAppWeb Training Material
TAppWeb Training MaterialArvie Bernal
 
TApp Web training material_rev4
TApp Web training material_rev4TApp Web training material_rev4
TApp Web training material_rev4Arvie Bernal
 
Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6Shahrzad Peyman
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
TApp Documentation
TApp DocumentationTApp Documentation
TApp DocumentationArvie Bernal
 
Mark css syntax & selector
Mark   css syntax & selectorMark   css syntax & selector
Mark css syntax & selectorLearningTech
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSRSolutions
 

Ähnlich wie jQuery BootCamp : Creating the Wrapped Element Set (20)

VISUAL CHEAT SHEET
VISUAL CHEAT SHEETVISUAL CHEAT SHEET
VISUAL CHEAT SHEET
 
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheet
 
J query 17-visual-cheat-sheet1
J query 17-visual-cheat-sheet1J query 17-visual-cheat-sheet1
J query 17-visual-cheat-sheet1
 
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)JQUERY EXAMPLE for Web Developer (Video Training Tutorial)
JQUERY EXAMPLE for Web Developer (Video Training Tutorial)
 
Jquery Example PPT
Jquery Example PPTJquery Example PPT
Jquery Example PPT
 
J query 1.5-visual-cheat-sheet
J query 1.5-visual-cheat-sheetJ query 1.5-visual-cheat-sheet
J query 1.5-visual-cheat-sheet
 
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdfUnit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
Unit 1 - What is jQuery_Why jQuery_Syntax_Selectors.pdf
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
 
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5eEo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
 
TAppWeb Training Material
TAppWeb Training MaterialTAppWeb Training Material
TAppWeb Training Material
 
TAppWeb Training Material
TAppWeb Training MaterialTAppWeb Training Material
TAppWeb Training Material
 
TApp Web training material_rev4
TApp Web training material_rev4TApp Web training material_rev4
TApp Web training material_rev4
 
Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
JQuery
JQueryJQuery
JQuery
 
TApp Documentation
TApp DocumentationTApp Documentation
TApp Documentation
 
jQuery Selectors
jQuery SelectorsjQuery Selectors
jQuery Selectors
 
Mark css syntax & selector
Mark   css syntax & selectorMark   css syntax & selector
Mark css syntax & selector
 
Web Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONSWeb Development Course - JQuery by RSOLUTIONS
Web Development Course - JQuery by RSOLUTIONS
 

Mehr von Wildan Maulana

Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Wildan Maulana
 
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Wildan Maulana
 
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonKetahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonWildan Maulana
 
Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Wildan Maulana
 
ICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipWildan Maulana
 
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWOpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWWildan Maulana
 
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...Wildan Maulana
 
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsPostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsWildan Maulana
 
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...Wildan Maulana
 
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpMensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpWildan Maulana
 
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity ProviderKonfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity ProviderWildan Maulana
 
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Wildan Maulana
 
Instalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpInstalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpWildan Maulana
 
River Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationRiver Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationWildan Maulana
 
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...Wildan Maulana
 
Penilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarPenilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarWildan Maulana
 
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesProyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesWildan Maulana
 
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaOpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaWildan Maulana
 
Menggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingMenggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingWildan Maulana
 

Mehr von Wildan Maulana (20)

Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018
 
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
 
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonKetahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
 
Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014
 
ICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi Arsip
 
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWOpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
 
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
 
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsPostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
 
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
 
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpMensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
 
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity ProviderKonfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
 
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
 
Instalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpInstalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphp
 
River Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationRiver Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River Restoration
 
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
 
Penilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarPenilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan Dasar
 
Statistik Listrik
Statistik ListrikStatistik Listrik
Statistik Listrik
 
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesProyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
 
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaOpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
 
Menggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingMenggunakan AlisJK : Equating
Menggunakan AlisJK : Equating
 

Kürzlich hochgeladen

WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 

Kürzlich hochgeladen (20)

WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 

jQuery BootCamp : Creating the Wrapped Element Set

  • 1. #2 Day #1 Creating the Wrapped Element Set Wildan Maulana wildan.m@openthinklabs.com http://workshop.openthinklabs.com
  • 2. This Presentation Cover ● Selecting elements to be wrapped by jQuery using selectors ● Creating and placing new HTML elements in the DOM ● Manipulating the wrapped element set
  • 3. Selecting elements for manipulation ● Selectors Lab
  • 4. Using basic CSS selectors ● Selection by an element's ID, CSS class name, tag name, and the DOM hierarchy of the page elements ● a → this selector matches all link (<a>) elements ● #specialD → This selector matches element that have an id of specialID ● .specialClass → This selector matches elements that have the class of specialClass ● a#specialID .specialClass → this selector matches links with an id of specialID and a class of specialClass ● p a.specialClass → This selector matches link with a class of specialClass declared within <p> elements Use Selector labs for exercise using various basic CSS selectors ... $("p a.specialClass")
  • 5. Using child, container, and attribute selectors <ul class="myList"> If we want to select the link to <li><a href="http://jquery.com">jQuery supports</a> <ul> the remote jQuery site basic <li><a href="css1">CSS1</a></li> css selector ul.myList li a will <li><a href="css2">CSS2</a></li> not work .. <li><a href="css3">CSS3</a></li> <li>Basic XPath</li> </ul> </li> The right approach is using <li>jQuery also supports child selectors : <ul> <li>Custom selectors</li> <li>Form selectors</li> </ul> </li> ul.myList > li > a </ul>
  • 6. Attribute Selectors ● To select a link that points to an external site we can use : <li><a href="http://jquery.com">jQuery supports</a> <ul> <li><a href="css1">CSS1</a></li> a[href^=http://] <li><a href="css2">CSS2</a></li> <li><a href="css3">CSS3</a></li> <li>Basic XPath</li> </ul> </li>
  • 7. More Attribute Selectors ● To match an element that possesses a specific attribute, regardless of its value, we can use ● form[method] : This matches any <form> element that has explicit method attribute ● input[type=text] : This selector matches all input elements with a type of text ● div[title^=my] : This selects elements with title attributes whose value begins with my ● a[href$=.pdf] : This selects all links that reference PDF files ● a[href*=jquery.com] : this selectow matches all <a> elements that reference jQuery site
  • 8. Container selector ● Container selector is useful if we want to select an element only if it contains some other element ● li:has(a) → This selector matches all <li> elements that contain an <a> element
  • 9. The basic Selectors Supported By jQuery Selector Elements * Matches any elements E Matches all elements with tag name EF Matches all elements with tag name F that are descendants of E E>F Matches all elements with tag name F that are direct children of F E+F Matches all elements F immediately preceded by sibling E E~F Matches all elements F preceded by any sibling E E:has(F) Matches all elements with tag name E that have at least one descendent with tag name F E.C Matches all elements E with class name C. Omitting E is the same as *.C E#I Matches elements E with id of I. Omitting E is the same as *#I E[A] Matches all elements E with attribute A of any value E[A=V] Matches all elements E with attribute A whose value is exactly V E[A^=V] Matches all elements E with attribute A whose value begins with V E[A$=V] Matches all elements E with attribute A whose value ends with V E[A*=V] Matches all elements E with attribute A whose value contains V
  • 10. Selecting by Position ● Consider we want to select the first link on the page, or every other paragraph, or the list item of each list. JQuery supports mechanisms for achieving these specific selections. ● For example : ● a:first → this format of selector matches the first <a> element on the page ● p:odd or p:even → this selector matches every odd or even paragraph ● li:last-child → this selector matches the last child of parent elements
  • 11. Advanced Positional selectors supported by jQuery Selector Description :first The first match of the page. Li a:first returns the first link also under a list item :last The last match of the page. Li a:last returns the last link also under a list item :first-child The first child element. li:first-child returns the first item of each child :last-child The last child element. li:last-child returns the last item of each list :only-child Returns all elements that have no siblings :nth-child(n) The nth child element. li:nth-child(2) returns the second list item of each list :nth-child(even|odd) Even or odd children. li:nth-child(even) return the even children of each list :nth-child(Xn+Y) The nth child element computed by the supplied formula.If Y is 0, it may be omitted. li:nth-child(3n) returns every third item, whereas li:nth-child(5n+1) return the item after every fifth element
  • 12. Advanced Positional selectors supported by jQuery (2) Selector Description :even and :odd Even and odd matching elements page-wide . li:even return every even list item :eq(n) Th nth matching element :gt(n) Matching elements after (and excluding) the nth matching element :lt(n) Matching elements before (and excluding) the nth matching element
  • 13. Using Custom jQuery Selector ● What if we want to select all check boxes that have been checked by the user ? ● We can use jQuery custom selector : :checked
  • 14. The jQuery custom filter selectors Selector Description :animated Selects elements that are currently under animated control :button Selects any button (input[type=submit], input[type=reset],input[type=reset], input[type=button] or button) :checkbox Selects only check box elements (input[type=checkbox]) :checked Selects only check boxes or radio button that are checked (supported by CSS) :contains(foo) Select only elements containing the text foo :disabled Select only form elements that are disabled in the interface (supported by CSS) :enabled Selects only form elements that are enabled in the interface (supported by CSS) :file Select all file elements (input[type=file])
  • 15. The jQuery custom filter selectors -2 Selector Description :header Selects only elements that are headers; for example (<h1>) through <h6> elements :hidden Selects only elements that are hidden :image Select form image (input[type=image]) :input Select only forms elements (input, select, textarea, button) :not(filter) Negates the specified filter :parent Selects only elements that have children (including text), but not an empty elements :password Selects only password elements (input[type=password]) :radio Selects only radio elements (input[type=radio]) :reset Selects reset buttons (input[type=reset]) or button[type=reset] :selected Select option element that are selected :submit Selects submit buttons (button[type=submit] or input[type=submit]) :text Select only text element (input[type=text]) :visible Selects only elements that are visible
  • 16. The jQuery custom filter selectors ● We can combine selector filters too : :checkbox:checked:enabled
  • 17. Using the :not filter ● input:not(:checkbox) → Select non-check-box <input> elements ● We cannot :not filter and other filters to find selector : div :not(p:hidden) → invalid div p:not(:hidden) → valied
  • 18. Jquery XPath Support ● http://jquery.com/plugins/project/xpath TODO : Learn about xpath support later, after we finish the book … @_@
  • 19. Generating new HTML $("<div class='foo'>I have foo!</div><div>I don't</div>") .filter(".foo").click(function() { alert("I'm foo!"); }).end().appendTo("#someParentDiv");
  • 20. Managing the wrapped element set
  • 21. Determining the size of the wrapped set $('#someDiv') .html('There are '+$('a').size()+' link(s) on this page.'); Remember that the set of jQuery wrapped elements acts a lot like an array. !
  • 22. Obtaining elements from the wrapped set ● jQuery allows us to treat the wrapped set as a JavaScript array, so we can use simple array indexing to obtain any element in the wrapped list by position : ● $('img[alt]')[0] or $('img[alt]').get(0) → get the first element in the set of all <img> elements with an alt attribute on the page
  • 23. Slicing and Dicing the Wrapped Element Set Live Demo
  • 24. Adding more element to the wrapped set $('img[alt]').add('img[title]')
  • 25. Adding more element to the wrapped set ● Let's say that we want to apply a thick border to all <img> elements with alt attributes, and then apply a level of transparency to all <img> elements with either alt or title attributes $('img[alt]').addClass('thickBorder').add('img[title]') .addClass('seeThrough')
  • 26. Honing the Content of the Wrapped Set Live Demo
  • 27. Q&A
  • 28. Reference ● JQuery in Action, Bear Bibeault, Yehuda Katz, Manning