SlideShare a Scribd company logo
1 of 39
Build an App with JavaScript & jQuery
October 2017
WIFI: The Department Guest
phx-webappbit.ly/
1
Welcome to "Build an App with Javascript and jQuery". The Wi-Fi network is X and the password is Y The website for this class is Z.
Speaker notes
Instructor
TA
Dave Hoel
Thinkful Graduate
Full Stack Web Developer
Coding Instructor
Dixon Begay
2
Let me start with a little about me. My name is X and my background is Y. We have some TA's that will be helping us today. I'm going to go around
and have them introduce themselves.
Speaker notes
About you
What's your name?
What's your coding experience?
Why do you want to learn JavaScript/jQuery?
http://www.loremipsum.com/example
Wi-Fi: orem Ipsum
PW: orem Ipsum
L
L 3
I'd love to learn a little more about you guys. So can we go around the room and can everyone give us your name, what your goal is for attending
the class and your programming background?
Speaker notes
Suggestions for learning
We're making something real!
The struggle is real!
Take full advantage of our support!
4
A few suggestions so you get the most out of tonight's workshop:
1. We're making something real! Yes, you're just learning, but you'll be able to take this with you when you leave and continue working on it, so don't
treat it like a drill, this is real-life coding!
2. The struggle is real! All "real" web developers struggle, and get frustrated, so don't be alarmed if it doesn't "click" right away. That's totally
natural. We'll spend the time to make it does eventually.
3. Use us! We're here to support you, so don't hesitate to interrupt if you don't get something, or ask for help whenever you need it.
Speaker notes
This is what we're making
http://www.loremipsum.com/example
Wi-Fi: orem Ipsum
PW: orem Ipsum
L
L 5
Today we're building a shopping list app. This app does three things. First you can type the list of an item to add and click the "add item" button to
add it to your shopping list. Second you can click on an item to check it off the list. Third you can click the X to remove the item altogether.
Speaker notes
Agenda
Go over starter code (10 min)
Learn key jQuery & JavaScript concepts (20 min)
Build your app! (30 min)
Go over solutions (10 min)
Next steps (10 min)
http://www.loremipsum.com/example
Wi-Fi: orem Ipsum
PW: orem Ipsum
L
L 6
Iā€™ll start by walking you through the HTML/CSS starter code so you have a reference of what youā€™ll be working with. Then Iā€™ll go over important
Javascript and jQuery concepts that youā€™ll need to complete the app. Youā€™ll then build the app during which time the TAā€™s and myself will be walking
around to help you guys out. At the end weā€™ll go over solutions and then cover next steps for continuing your learning.
Speaker notes
Quick HTML/CSS Refresher
7
HTML deļ¬nes the content and the structure of a page. We use "tags" to divide our HTML into sections. Each section of HTML has an opening tag,
and a closing tag (demonstrate).
In our HTML, we can create labels for our sections. We create labels by adding a "class=" some name in our opening tag. These labels help us
"grab" these sections both to add styles. But also as we'll see with jQuery, to manipulate our HTML with Javascript.
Lets start with adding styles. We add styles with CSS. We can basically grab a section using it's class. Then we can deļ¬ne different aspects of the
section we want to change. (demonstrate)
In this case, we are going to grab the "title" section, then make it blue and put a line through it.
Speaker notes
Starter code walkthrough
http://bit.ly/tf-shopping-list
bit.ly/web-app-la
8
Alright, now let's dive into the starter code. Go ahead and go to this url to get the starter code. Weā€™re using a online code editor called Glitch which
will let us see the result of our code really quickly.
On the README.MD ļ¬le you should see an overview of the project and the challenges you'll be completing. The ļ¬les weā€™ll be using today on the left
are client.js, style.css, and index.html. You can ignore server.js, package.json and .env. Once youā€™ve written some code, click the ā€œShow Liveā€ button
at the top to open a new tab that will automatically update as you edit your code.
Next let's go over the starter code so you guys know whatā€™s going on. At the top of our index.html, we have a head element. This element is different
from most others because what it contains wonā€™t actually show up on the page. The main purpose of the head section is to pull other ļ¬les into our
app. This is known as ā€œimportingā€. You can see here that we're importing our styles.css, our client.js, and jQuery which will be discussing soon.
We generally put the content of our HTML, the stuff people might see, in the "body" section of our HTML (versus the "head" section).
The "list-content" section houses the three main components of our app. The ļ¬rst component is the text box where a user will type in their shopping
list item. The second component is a list where we will add items to our shopping cart. It's empty for now but as we add items to our list, it will show
up here. The third component is a button called Add Item. When people click on this button, the item they type in will be added to the list.
Speaker notes
Think of our HTML as a "tree"
<form>
list-content
<input>
item-input
<ul>
shopping-list
<button>
add-item
9
We can visualize these HTML components as a tree. We have a list-content section but inside that section, we have three smaller sections: our text
input, our shopping list, and our button.
In HTML, we call this tree the DOM or the "Document Object Model". In this system, list-content is the "parent" to the three components and the
three components are the "children" to list-content.
Speaker notes
What is JavaScript? What is jQuery?
<input>
<ul>
shopping-list <button>
<li>
String
cheese
<li>
Summer
sausage
<li>
Chicken
nuggets
10
<div>
jQuery is an extension of Javascript. jQuery does a bunch of things one of which is to make it easy to add, modify and remove items from our DOM.
70% of websites use jQuery.
For this app, what we want to do is add sections to our shopping list after someone adds a grocery item to the input box and then taps the button. So
when someone taps the button, we'll add a new section to the shopping list section, one section for each item added. Those items will be children to
shopping list, which is a child to list-content.
Speaker notes
"Grabbing" a section directly
$('.shopping-list')
jQuery always starts with this
Element to grab
11
jQuery makes it really easy to add, change, and remove sections from our HTML.
In this case we want to add to a section. The ļ¬rst thing we must do is to tell the computer which section we want to grab.
In jQuery, the ļ¬rst thing we'll do is start our line of code with a "$". This tells the computer we're writing a jQuery command. Then inside the
parentheses, we add the "class" of the section we want to grab. So in this case, "shopping-list" but starting with a ".".
Speaker notes
jQuery walkthrough
12
NOTE: All lines for the walkthrough are accessible in the Javascript tab of the demo.
Once we grab the right section, we can then use jQuery to perform some action: to add, change, or remove, that section.
Lets start by seeing how we can use jQuery to add and remove sections from our app. To add a section, the ļ¬rst thing we want to do is grab the
section we want to add to. In this case, we want to add our shopping items to the shopping-list section. So we'll $('.shopping-list'). Then we want to
perform an add action. One add action is .append. So lets say we want to add an apple to our shopping list we can do this:
$('.shopping-list').append("
apples
")
Now we've added this item and given it a label "item". To remove the items we added, we can then do this:
$('.item').remove()
Another thing we can use jQuery for is to change how a section looks. There are a number of ways to do this but the best way to do this is to deļ¬ne
a new class in your CSS and then add or remove those "labels" or "classes" to sections. (enable the CSS tab for this section)
Lets say we wanted to use jQuery to change the background color of our header section to pink. In this case, we'd deļ¬ne a new class called "pink".
When we add "pink" as a class to the header section, background color will change to pink.
$('header').addClass('pink')
You can see here that in this case, header is not a class, but the name of a tag. To grab all sections with a speciļ¬c HTML tag, we just give the tag
name without the period in front.
With jQuery, we can "chain" actions together. So once we grab a section, we can perform action after action on it in a particular order. Here's an
example of using chaining to change the button.
$('.add-item').text("Add Shopping Item").css("background", "pink")
Finally, you can use jQuery to "traverse" or move up and down the HTML tree to select elements. The easiest way to grab an element is to grab it
directly via it's class label. But in some cases, you might not know the class label you want to grab, just where it is in relation to another section. In
those cases, you can "traverse" the tree to grab the right section before acting on it. Here's an example:
Speaker notes
$('.shopping-list').append("
Apple
")
$('.shopping-list').children().ļ¬rst().text("Oranges")
Attaching an "Event Listener"
http://www.loremipsum.com/example
Wi-Fi: orem Ipsum
PW: orem Ipsum
L
L 13
jQuery also lets us manage what happens when some event occurs, say when someone clicks on our button. We do this by attaching a "listener" on
a section. A section would then listen, for say, a "click" and then execute the actions we tell it to once that section is clicked.
The code will run every time it "hears" that event. The easiest way to attach a listener is when a section has been loaded. There are, however, ways
to add listeners to sections that we expect will be loaded but haven't yet.
In this case, we want to add an event listener to our button so when someone clicks on it, the text of the button changes and as well as the
background color of the button.
We see here that we've added a listener to add-item and then we grab add-item again. Instead of repeating ourselves, jQuery lets us refer to thing
that was clicked by just saying event.currentTarget. This is an important concept that you'll build on later as you do more programming.
Speaker notes
Real developers use Google... a lot
14
Google is an everyday part of being a developer. A key part of becoming a developer is getting comfortable using Google to learn and look up things.
The more you code, the more you will use Google, not the other way around. When you get stuck tonight, or whenever, make sure to Google it ļ¬rst!
Speaker notes
Let's work on the ļ¬rst step together
http://bit.ly/tf-shopping-list
http://www.loremipsum.com/example
Wi-Fi: orem Ipsum
PW: orem Ipsum
L
L 15
Alright, with that let's start building our app.
On the left, you can see the ļ¬les you'll be working on. The Readme will give you instructions. You'll be writing your code in client.js but referring to
style.css and index.html. You shouldn't need to touch any of the other ļ¬les.
After you write your code, it will automatically be saved. At any point you can hit "Show Live" to see a live version of your app.
Let's start the ļ¬rst step together. So in this ļ¬rst step, we're adding an event listener to the add-item button so when it's clicked, we're going to
execute this code which should grab the text in the input box and add that item to our shopping list.
The ļ¬rst thing we want to do is grab the value in our input box. How would we grab that element? (Ultimately ļ¬ll in answer)
Alright, once we grab that element, how might we pull out the text inside it? We haven't shown you this yet so I want you guys to Google "getting a
value out of an input box with jQuery". Does anyone know the right function to use? (Ultimately ļ¬ll in the answer)
Alright so now we've stored the text from our input box in this variable listItem. So when we write listItem, that value will show up. We've combined
that listItem with some HTML to add to our shopping list. Then once you're done with that, we want to zero out the text in our input box. Take it from
here!
(Assign TA's to different sections of class)
Speaker notes
Solution
16
Alright. Let's go over the solutions to the main challenges.
The ļ¬rst task was to add HTML to the shopping list. We do that with the "prepend" or "append" action. In the parentheses we just give the computer
the HTML we want to add. To zero-out the input box, we grab the item-input section and use the .val function to set the box to "".
For the second challenge, the user will click on the X button. When we try to remove it, it just removed the X. What we need to do is "traverse" to the
parent of the X which is the entire section and remove that. We can chain these actions together.
Finally, when we click on the checkbox next to the item, we want to add or remove the "complete" class to add and remove the checkmark. We can
do this pretty easily with the toggleClass function.
Speaker notes
17
As we talked about earlier, Google is every developer's best friend, and here are some of the other great free resources you'll come across.
But if you're interested in actually working towards a career as a developer, you'll want far more support and structure while learning. It's very
important that you have someone to turn to when you need help, and that you're studying the right tools. It's also very important that you build a
unique portfolio, which is often difļ¬cult to do without support.
That's where bootcamps like Thinkful come in. We focus on helping you work through a structured program with the right level of support.
Speaker notes
18
19
20
21

More Related Content

What's hot

Joomla Quick Start 1
Joomla  Quick  Start 1Joomla  Quick  Start 1
Joomla Quick Start 1guest38bfe1
Ā 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop NotesPamela Fox
Ā 
How to Build a Yahoo! SearchMonkey App
How to Build a Yahoo! SearchMonkey AppHow to Build a Yahoo! SearchMonkey App
How to Build a Yahoo! SearchMonkey Apppost.chris
Ā 
Web Performance Tips
Web Performance TipsWeb Performance Tips
Web Performance TipsRavi Raj
Ā 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint DevZeddy Iskandar
Ā 
Intro wordpress (1) copy with dipesh sharma
Intro wordpress (1)   copy with dipesh sharmaIntro wordpress (1)   copy with dipesh sharma
Intro wordpress (1) copy with dipesh sharmadegana2009
Ā 
CHILD Site Coordinator Training
CHILD Site Coordinator TrainingCHILD Site Coordinator Training
CHILD Site Coordinator Trainingehealth
Ā 
Fewd week8 slides
Fewd week8 slidesFewd week8 slides
Fewd week8 slidesWilliam Myers
Ā 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slidesWilliam Myers
Ā 
Accessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesAccessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesRuss Weakley
Ā 
Windows Vista
Windows VistaWindows Vista
Windows Vistacartsh
Ā 
Using Wordpress with Reclaim Hosting
Using Wordpress with Reclaim HostingUsing Wordpress with Reclaim Hosting
Using Wordpress with Reclaim HostingCindy Royal
Ā 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryRefresh Events
Ā 
Office 365 Productivity Tips "Summer Scuffle"
Office 365 Productivity Tips "Summer Scuffle"Office 365 Productivity Tips "Summer Scuffle"
Office 365 Productivity Tips "Summer Scuffle"Christian Buckley
Ā 
Accessible modal windows
Accessible modal windowsAccessible modal windows
Accessible modal windowsRuss Weakley
Ā 
Drupal Gardens Tutorial 1 of 4
Drupal Gardens Tutorial 1 of 4Drupal Gardens Tutorial 1 of 4
Drupal Gardens Tutorial 1 of 4Kevin Duggan
Ā 
Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Aaron Gustafson
Ā 

What's hot (19)

Joomla Quick Start 1
Joomla  Quick  Start 1Joomla  Quick  Start 1
Joomla Quick Start 1
Ā 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop Notes
Ā 
How to Build a Yahoo! SearchMonkey App
How to Build a Yahoo! SearchMonkey AppHow to Build a Yahoo! SearchMonkey App
How to Build a Yahoo! SearchMonkey App
Ā 
Web Performance Tips
Web Performance TipsWeb Performance Tips
Web Performance Tips
Ā 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint Dev
Ā 
Intro wordpress (1) copy with dipesh sharma
Intro wordpress (1)   copy with dipesh sharmaIntro wordpress (1)   copy with dipesh sharma
Intro wordpress (1) copy with dipesh sharma
Ā 
CHILD Site Coordinator Training
CHILD Site Coordinator TrainingCHILD Site Coordinator Training
CHILD Site Coordinator Training
Ā 
Fewd week8 slides
Fewd week8 slidesFewd week8 slides
Fewd week8 slides
Ā 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slides
Ā 
Wikispaces
WikispacesWikispaces
Wikispaces
Ā 
Accessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxesAccessible custom radio buttons and checkboxes
Accessible custom radio buttons and checkboxes
Ā 
Windows Vista
Windows VistaWindows Vista
Windows Vista
Ā 
Using Wordpress with Reclaim Hosting
Using Wordpress with Reclaim HostingUsing Wordpress with Reclaim Hosting
Using Wordpress with Reclaim Hosting
Ā 
Eugene Andruszczenko: jQuery
Eugene Andruszczenko: jQueryEugene Andruszczenko: jQuery
Eugene Andruszczenko: jQuery
Ā 
How to use IFTTT
How to use IFTTTHow to use IFTTT
How to use IFTTT
Ā 
Office 365 Productivity Tips "Summer Scuffle"
Office 365 Productivity Tips "Summer Scuffle"Office 365 Productivity Tips "Summer Scuffle"
Office 365 Productivity Tips "Summer Scuffle"
Ā 
Accessible modal windows
Accessible modal windowsAccessible modal windows
Accessible modal windows
Ā 
Drupal Gardens Tutorial 1 of 4
Drupal Gardens Tutorial 1 of 4Drupal Gardens Tutorial 1 of 4
Drupal Gardens Tutorial 1 of 4
Ā 
Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]
Ā 

Similar to Baawjsajq109

La build your own website september 5
La build your own website september 5La build your own website september 5
La build your own website september 5Thinkful
Ā 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdfmurad3003
Ā 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculatorVlad Kolesnyk
Ā 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823Thinkful
Ā 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginnersIsfand yar Khan
Ā 
Spiffy Applications With JavaScript
Spiffy Applications With JavaScriptSpiffy Applications With JavaScript
Spiffy Applications With JavaScriptMark Casias
Ā 
Project guideline
Project guidelineProject guideline
Project guidelineAdrian Yi
Ā 
Knockout in action
Knockout in actionKnockout in action
Knockout in actionGerardo Leyes
Ā 
How to use a blog for publishing scientific research: A training guide part 2
How to use a blog for publishing scientific research: A training guide part 2How to use a blog for publishing scientific research: A training guide part 2
How to use a blog for publishing scientific research: A training guide part 2AfricanCommonsProject
Ā 
How to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a ProHow to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a ProRonDosh
Ā 
Documentation For Tab Setup
Documentation For Tab SetupDocumentation For Tab Setup
Documentation For Tab Setupvkeeton
Ā 
Access tips access and sql part 4 building select queries on-the-fly
Access tips  access and sql part 4  building select queries on-the-flyAccess tips  access and sql part 4  building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-flyquest2900
Ā 
Link your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfLink your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfBe Problem Solver
Ā 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateSean Burgess
Ā 
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseCoding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseEuropean Innovation Academy
Ā 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experimentslacyrhoades
Ā 
The EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingThe EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingEffiChange LLC
Ā 

Similar to Baawjsajq109 (20)

La build your own website september 5
La build your own website september 5La build your own website september 5
La build your own website september 5
Ā 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Ā 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
Ā 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
Ā 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
Ā 
Fccwc326
Fccwc326Fccwc326
Fccwc326
Ā 
BYOWHC823
BYOWHC823BYOWHC823
BYOWHC823
Ā 
Jquery tutorial-beginners
Jquery tutorial-beginnersJquery tutorial-beginners
Jquery tutorial-beginners
Ā 
Spiffy Applications With JavaScript
Spiffy Applications With JavaScriptSpiffy Applications With JavaScript
Spiffy Applications With JavaScript
Ā 
Project guideline
Project guidelineProject guideline
Project guideline
Ā 
Knockout in action
Knockout in actionKnockout in action
Knockout in action
Ā 
How to use a blog for publishing scientific research: A training guide part 2
How to use a blog for publishing scientific research: A training guide part 2How to use a blog for publishing scientific research: A training guide part 2
How to use a blog for publishing scientific research: A training guide part 2
Ā 
How to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a ProHow to Use Material UI Tooltip Component Like a Pro
How to Use Material UI Tooltip Component Like a Pro
Ā 
Documentation For Tab Setup
Documentation For Tab SetupDocumentation For Tab Setup
Documentation For Tab Setup
Ā 
Access tips access and sql part 4 building select queries on-the-fly
Access tips  access and sql part 4  building select queries on-the-flyAccess tips  access and sql part 4  building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-fly
Ā 
Link your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdfLink your HTML Form to Google Sheet in just 3 Steps.pdf
Link your HTML Form to Google Sheet in just 3 Steps.pdf
Ā 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Ā 
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger KerseCoding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Ā 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experiments
Ā 
The EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages ScaffoldingThe EffiChange XPager Suite: Understanding XPages Scaffolding
The EffiChange XPager Suite: Understanding XPages Scaffolding
Ā 

More from Thinkful

893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370Thinkful
Ā 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsThinkful
Ā 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsThinkful
Ā 
Itjsf129
Itjsf129Itjsf129
Itjsf129Thinkful
Ā 
Twit botsd1.30.18
Twit botsd1.30.18Twit botsd1.30.18
Twit botsd1.30.18Thinkful
Ā 
Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)Thinkful
Ā 
Baggwjs124
Baggwjs124Baggwjs124
Baggwjs124Thinkful
Ā 
Become a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info SessionBecome a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info SessionThinkful
Ā 
Vpet sd-1.25.18
Vpet sd-1.25.18Vpet sd-1.25.18
Vpet sd-1.25.18Thinkful
Ā 
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info SessionLA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info SessionThinkful
Ā 
How to Choose a Programming Language
How to Choose a Programming LanguageHow to Choose a Programming Language
How to Choose a Programming LanguageThinkful
Ā 
Batbwjs117
Batbwjs117Batbwjs117
Batbwjs117Thinkful
Ā 
1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop1/16/18 Intro to JS Workshop
1/16/18 Intro to JS WorkshopThinkful
Ā 
LA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: FundamentalsLA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: FundamentalsThinkful
Ā 
(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: FundamentalsThinkful
Ā 
Websitesd1.15.17.
Websitesd1.15.17.Websitesd1.15.17.
Websitesd1.15.17.Thinkful
Ā 
Bavpwjs110
Bavpwjs110Bavpwjs110
Bavpwjs110Thinkful
Ā 
Byowwhc110
Byowwhc110Byowwhc110
Byowwhc110Thinkful
Ā 
Getting started-jan-9-2018
Getting started-jan-9-2018Getting started-jan-9-2018
Getting started-jan-9-2018Thinkful
Ā 
Introjs1.9.18tf
Introjs1.9.18tfIntrojs1.9.18tf
Introjs1.9.18tfThinkful
Ā 

More from Thinkful (20)

893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
893ff61f-1fb8-4e15-a379-775dfdbcee77-7-14-25-46-115-141-308-324-370
Ā 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
Ā 
LA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: FundamentalsLA 1/31/18 Intro to JavaScript: Fundamentals
LA 1/31/18 Intro to JavaScript: Fundamentals
Ā 
Itjsf129
Itjsf129Itjsf129
Itjsf129
Ā 
Twit botsd1.30.18
Twit botsd1.30.18Twit botsd1.30.18
Twit botsd1.30.18
Ā 
Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)Build your-own-instagram-filters-with-javascript-202-335 (1)
Build your-own-instagram-filters-with-javascript-202-335 (1)
Ā 
Baggwjs124
Baggwjs124Baggwjs124
Baggwjs124
Ā 
Become a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info SessionBecome a Data Scientist: A Thinkful Info Session
Become a Data Scientist: A Thinkful Info Session
Ā 
Vpet sd-1.25.18
Vpet sd-1.25.18Vpet sd-1.25.18
Vpet sd-1.25.18
Ā 
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info SessionLA 1/18/18 Become A Web Developer: A Thinkful Info Session
LA 1/18/18 Become A Web Developer: A Thinkful Info Session
Ā 
How to Choose a Programming Language
How to Choose a Programming LanguageHow to Choose a Programming Language
How to Choose a Programming Language
Ā 
Batbwjs117
Batbwjs117Batbwjs117
Batbwjs117
Ā 
1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop1/16/18 Intro to JS Workshop
1/16/18 Intro to JS Workshop
Ā 
LA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: FundamentalsLA 1/16/18 Intro to Javascript: Fundamentals
LA 1/16/18 Intro to Javascript: Fundamentals
Ā 
(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals(LA 1/16/18) Intro to JavaScript: Fundamentals
(LA 1/16/18) Intro to JavaScript: Fundamentals
Ā 
Websitesd1.15.17.
Websitesd1.15.17.Websitesd1.15.17.
Websitesd1.15.17.
Ā 
Bavpwjs110
Bavpwjs110Bavpwjs110
Bavpwjs110
Ā 
Byowwhc110
Byowwhc110Byowwhc110
Byowwhc110
Ā 
Getting started-jan-9-2018
Getting started-jan-9-2018Getting started-jan-9-2018
Getting started-jan-9-2018
Ā 
Introjs1.9.18tf
Introjs1.9.18tfIntrojs1.9.18tf
Introjs1.9.18tf
Ā 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Ā 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
Ā 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
Ā 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
Ā 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
Ā 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
Ā 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
Ā 
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdfssuser54595a
Ā 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Ā 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
Ā 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
Ā 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
Ā 
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø9953056974 Low Rate Call Girls In Saket, Delhi NCR
Ā 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
Ā 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
Ā 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
Ā 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
Ā 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
Ā 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Ā 
Model Call Girl in Bikash Puri Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at šŸ”9953056974šŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at šŸ”9953056974šŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at šŸ”9953056974šŸ”
Ā 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
Ā 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
Ā 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
Ā 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
Ā 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
Ā 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
Ā 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
Ā 
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAŠ”Y_INDEX-DM_23-1-final-eng.pdf
Ā 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Ā 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
Ā 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Ā 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
Ā 
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļøcall girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
call girls in Kamla Market (DELHI) šŸ” >ą¼’9953330565šŸ” genuine Escort Service šŸ”āœ”ļøāœ”ļø
Ā 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Ā 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
Ā 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Ā 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
Ā 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
Ā 

Baawjsajq109

  • 1. Build an App with JavaScript & jQuery October 2017 WIFI: The Department Guest phx-webappbit.ly/ 1
  • 2. Welcome to "Build an App with Javascript and jQuery". The Wi-Fi network is X and the password is Y The website for this class is Z. Speaker notes
  • 3. Instructor TA Dave Hoel Thinkful Graduate Full Stack Web Developer Coding Instructor Dixon Begay 2
  • 4. Let me start with a little about me. My name is X and my background is Y. We have some TA's that will be helping us today. I'm going to go around and have them introduce themselves. Speaker notes
  • 5. About you What's your name? What's your coding experience? Why do you want to learn JavaScript/jQuery? http://www.loremipsum.com/example Wi-Fi: orem Ipsum PW: orem Ipsum L L 3
  • 6. I'd love to learn a little more about you guys. So can we go around the room and can everyone give us your name, what your goal is for attending the class and your programming background? Speaker notes
  • 7. Suggestions for learning We're making something real! The struggle is real! Take full advantage of our support! 4
  • 8. A few suggestions so you get the most out of tonight's workshop: 1. We're making something real! Yes, you're just learning, but you'll be able to take this with you when you leave and continue working on it, so don't treat it like a drill, this is real-life coding! 2. The struggle is real! All "real" web developers struggle, and get frustrated, so don't be alarmed if it doesn't "click" right away. That's totally natural. We'll spend the time to make it does eventually. 3. Use us! We're here to support you, so don't hesitate to interrupt if you don't get something, or ask for help whenever you need it. Speaker notes
  • 9. This is what we're making http://www.loremipsum.com/example Wi-Fi: orem Ipsum PW: orem Ipsum L L 5
  • 10. Today we're building a shopping list app. This app does three things. First you can type the list of an item to add and click the "add item" button to add it to your shopping list. Second you can click on an item to check it off the list. Third you can click the X to remove the item altogether. Speaker notes
  • 11. Agenda Go over starter code (10 min) Learn key jQuery & JavaScript concepts (20 min) Build your app! (30 min) Go over solutions (10 min) Next steps (10 min) http://www.loremipsum.com/example Wi-Fi: orem Ipsum PW: orem Ipsum L L 6
  • 12. Iā€™ll start by walking you through the HTML/CSS starter code so you have a reference of what youā€™ll be working with. Then Iā€™ll go over important Javascript and jQuery concepts that youā€™ll need to complete the app. Youā€™ll then build the app during which time the TAā€™s and myself will be walking around to help you guys out. At the end weā€™ll go over solutions and then cover next steps for continuing your learning. Speaker notes
  • 14. HTML deļ¬nes the content and the structure of a page. We use "tags" to divide our HTML into sections. Each section of HTML has an opening tag, and a closing tag (demonstrate). In our HTML, we can create labels for our sections. We create labels by adding a "class=" some name in our opening tag. These labels help us "grab" these sections both to add styles. But also as we'll see with jQuery, to manipulate our HTML with Javascript. Lets start with adding styles. We add styles with CSS. We can basically grab a section using it's class. Then we can deļ¬ne different aspects of the section we want to change. (demonstrate) In this case, we are going to grab the "title" section, then make it blue and put a line through it. Speaker notes
  • 16. Alright, now let's dive into the starter code. Go ahead and go to this url to get the starter code. Weā€™re using a online code editor called Glitch which will let us see the result of our code really quickly. On the README.MD ļ¬le you should see an overview of the project and the challenges you'll be completing. The ļ¬les weā€™ll be using today on the left are client.js, style.css, and index.html. You can ignore server.js, package.json and .env. Once youā€™ve written some code, click the ā€œShow Liveā€ button at the top to open a new tab that will automatically update as you edit your code. Next let's go over the starter code so you guys know whatā€™s going on. At the top of our index.html, we have a head element. This element is different from most others because what it contains wonā€™t actually show up on the page. The main purpose of the head section is to pull other ļ¬les into our app. This is known as ā€œimportingā€. You can see here that we're importing our styles.css, our client.js, and jQuery which will be discussing soon. We generally put the content of our HTML, the stuff people might see, in the "body" section of our HTML (versus the "head" section). The "list-content" section houses the three main components of our app. The ļ¬rst component is the text box where a user will type in their shopping list item. The second component is a list where we will add items to our shopping cart. It's empty for now but as we add items to our list, it will show up here. The third component is a button called Add Item. When people click on this button, the item they type in will be added to the list. Speaker notes
  • 17. Think of our HTML as a "tree" <form> list-content <input> item-input <ul> shopping-list <button> add-item 9
  • 18. We can visualize these HTML components as a tree. We have a list-content section but inside that section, we have three smaller sections: our text input, our shopping list, and our button. In HTML, we call this tree the DOM or the "Document Object Model". In this system, list-content is the "parent" to the three components and the three components are the "children" to list-content. Speaker notes
  • 19. What is JavaScript? What is jQuery? <input> <ul> shopping-list <button> <li> String cheese <li> Summer sausage <li> Chicken nuggets 10 <div>
  • 20. jQuery is an extension of Javascript. jQuery does a bunch of things one of which is to make it easy to add, modify and remove items from our DOM. 70% of websites use jQuery. For this app, what we want to do is add sections to our shopping list after someone adds a grocery item to the input box and then taps the button. So when someone taps the button, we'll add a new section to the shopping list section, one section for each item added. Those items will be children to shopping list, which is a child to list-content. Speaker notes
  • 21. "Grabbing" a section directly $('.shopping-list') jQuery always starts with this Element to grab 11
  • 22. jQuery makes it really easy to add, change, and remove sections from our HTML. In this case we want to add to a section. The ļ¬rst thing we must do is to tell the computer which section we want to grab. In jQuery, the ļ¬rst thing we'll do is start our line of code with a "$". This tells the computer we're writing a jQuery command. Then inside the parentheses, we add the "class" of the section we want to grab. So in this case, "shopping-list" but starting with a ".". Speaker notes
  • 24. NOTE: All lines for the walkthrough are accessible in the Javascript tab of the demo. Once we grab the right section, we can then use jQuery to perform some action: to add, change, or remove, that section. Lets start by seeing how we can use jQuery to add and remove sections from our app. To add a section, the ļ¬rst thing we want to do is grab the section we want to add to. In this case, we want to add our shopping items to the shopping-list section. So we'll $('.shopping-list'). Then we want to perform an add action. One add action is .append. So lets say we want to add an apple to our shopping list we can do this: $('.shopping-list').append(" apples ") Now we've added this item and given it a label "item". To remove the items we added, we can then do this: $('.item').remove() Another thing we can use jQuery for is to change how a section looks. There are a number of ways to do this but the best way to do this is to deļ¬ne a new class in your CSS and then add or remove those "labels" or "classes" to sections. (enable the CSS tab for this section) Lets say we wanted to use jQuery to change the background color of our header section to pink. In this case, we'd deļ¬ne a new class called "pink". When we add "pink" as a class to the header section, background color will change to pink. $('header').addClass('pink') You can see here that in this case, header is not a class, but the name of a tag. To grab all sections with a speciļ¬c HTML tag, we just give the tag name without the period in front. With jQuery, we can "chain" actions together. So once we grab a section, we can perform action after action on it in a particular order. Here's an example of using chaining to change the button. $('.add-item').text("Add Shopping Item").css("background", "pink") Finally, you can use jQuery to "traverse" or move up and down the HTML tree to select elements. The easiest way to grab an element is to grab it directly via it's class label. But in some cases, you might not know the class label you want to grab, just where it is in relation to another section. In those cases, you can "traverse" the tree to grab the right section before acting on it. Here's an example: Speaker notes
  • 26. Attaching an "Event Listener" http://www.loremipsum.com/example Wi-Fi: orem Ipsum PW: orem Ipsum L L 13
  • 27. jQuery also lets us manage what happens when some event occurs, say when someone clicks on our button. We do this by attaching a "listener" on a section. A section would then listen, for say, a "click" and then execute the actions we tell it to once that section is clicked. The code will run every time it "hears" that event. The easiest way to attach a listener is when a section has been loaded. There are, however, ways to add listeners to sections that we expect will be loaded but haven't yet. In this case, we want to add an event listener to our button so when someone clicks on it, the text of the button changes and as well as the background color of the button. We see here that we've added a listener to add-item and then we grab add-item again. Instead of repeating ourselves, jQuery lets us refer to thing that was clicked by just saying event.currentTarget. This is an important concept that you'll build on later as you do more programming. Speaker notes
  • 28. Real developers use Google... a lot 14
  • 29. Google is an everyday part of being a developer. A key part of becoming a developer is getting comfortable using Google to learn and look up things. The more you code, the more you will use Google, not the other way around. When you get stuck tonight, or whenever, make sure to Google it ļ¬rst! Speaker notes
  • 30. Let's work on the ļ¬rst step together http://bit.ly/tf-shopping-list http://www.loremipsum.com/example Wi-Fi: orem Ipsum PW: orem Ipsum L L 15
  • 31. Alright, with that let's start building our app. On the left, you can see the ļ¬les you'll be working on. The Readme will give you instructions. You'll be writing your code in client.js but referring to style.css and index.html. You shouldn't need to touch any of the other ļ¬les. After you write your code, it will automatically be saved. At any point you can hit "Show Live" to see a live version of your app. Let's start the ļ¬rst step together. So in this ļ¬rst step, we're adding an event listener to the add-item button so when it's clicked, we're going to execute this code which should grab the text in the input box and add that item to our shopping list. The ļ¬rst thing we want to do is grab the value in our input box. How would we grab that element? (Ultimately ļ¬ll in answer) Alright, once we grab that element, how might we pull out the text inside it? We haven't shown you this yet so I want you guys to Google "getting a value out of an input box with jQuery". Does anyone know the right function to use? (Ultimately ļ¬ll in the answer) Alright so now we've stored the text from our input box in this variable listItem. So when we write listItem, that value will show up. We've combined that listItem with some HTML to add to our shopping list. Then once you're done with that, we want to zero out the text in our input box. Take it from here! (Assign TA's to different sections of class) Speaker notes
  • 33. Alright. Let's go over the solutions to the main challenges. The ļ¬rst task was to add HTML to the shopping list. We do that with the "prepend" or "append" action. In the parentheses we just give the computer the HTML we want to add. To zero-out the input box, we grab the item-input section and use the .val function to set the box to "". For the second challenge, the user will click on the X button. When we try to remove it, it just removed the X. What we need to do is "traverse" to the parent of the X which is the entire section and remove that. We can chain these actions together. Finally, when we click on the checkbox next to the item, we want to add or remove the "complete" class to add and remove the checkmark. We can do this pretty easily with the toggleClass function. Speaker notes
  • 34. 17
  • 35. As we talked about earlier, Google is every developer's best friend, and here are some of the other great free resources you'll come across. But if you're interested in actually working towards a career as a developer, you'll want far more support and structure while learning. It's very important that you have someone to turn to when you need help, and that you're studying the right tools. It's also very important that you build a unique portfolio, which is often difļ¬cult to do without support. That's where bootcamps like Thinkful come in. We focus on helping you work through a structured program with the right level of support. Speaker notes
  • 36. 18
  • 37. 19
  • 38. 20
  • 39. 21