 Welcome to Read: 02
             Welcome to Read: 02
jQuery, Events, and The DOM
In this Read: 02, I will talk about those topics:
- Pair Programming.
-  jQuery. 
Pair Programming 
Pair programming touches on all four skills: developers explain out loud what the code should do, listen to others’ guidance, read code that others have written, and write code themselves. 
During a five-hour paired lab session, Code Fellows students work on all four of these language-specific skills. The abilities they foster will serve them well in completing assignments, in their own communication and learning, in interviews, and in readiness for a job at a company that utilizes this agile practice. 
- 
    Why pair program? - 
        Greater efficiency 
- 
        Engaged collaboration 
- 
        Learning from fellow students 
- 
        Social skills 
- 
        Job interview readiness 
- 
        Work environment readiness 
 
- 
        
jQuery  
jQuery offers a simple way to achieve a variety of common JavaScript tasks quickly and consistently, across all major
browsers and without any fallback code needed..
- 
    WHY USE JQUERY? - 
        SIMPLE SELECTORS 
- 
        COMMON TASKS IN LESS CODE 
- 
        CROSS-BROWSER COMPATIBILITY 
 
- 
        
- 
    jQuery’s motto is “Write less, do more,” because it allows you to achieve the same goals but in fewer lines of code than you would need to write with plain JavaScript. 
- 
    GETTING ELEMENT CONTENT - 
        .html()When this method is used to retrieve information from a jQuery selection, it retrieves only the HTML inside the first element in the matched set, along with any of its descendants.
- 
        .text()When this method is used to retrieve the text from a jQuery selection, it returns the content from every element in the jQuery selection, along with the text from any descendants.
 
- 
        
- 
    UPDATING ELEMENTS - 
        .html()This method gives every element in the matched set the same new content. The new content may include HTML.
- 
        .text()This method gives every element in the matched set the same new text content. Any markup would be shown as text.
- 
        .replaceWith()This method replaces every element in a matched set with new content. It also returns the replaced elements.
- 
        .remove()This method removes all of the elements in the matched set.
 
- 
        
- 
    INSERTING ELEMENTS 
 Inserting new elements involves two steps:- Create the new elements in a jQuery object.
 - The following statement creates a variable called $newFragment and stores a jQuery object in it. The jQuery object is set to contain an empty. 
 <li>element:var $newFragment = $('<li>'};
 
- The following statement creates a variable called $newFragment and stores a jQuery object in it. The jQuery object is set to contain an empty. 
- Use a method to insert the content into the page.
        - .before()This method inserts content before the selected element(s) .
- .after()This method inserts content after the selected element(s).
- .prepend()This method inserts content inside the selected element(s), after the opening tag
- .append()This method inserts content inside the selected element(s), before the closing tag.
 
 
- Create the new elements in a jQuery object.
For further infromation please see the : avaScript and jQuery book by Jon Duckett

