Getting started with jQuery (tutorial) - Beau teaches JavaScript
Key Takeaways
The video tutorial introduces jQuery, a lightweight JavaScript library, and covers its basic syntax, including selectors, actions, and events, with examples of DOM manipulation and AJAX calls.
Full Transcript
jQuery is a very popular lightweight JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on websites. jQuery simplifies a lot of the complicated things from JavaScript like Ajax calls and DOM manipulation. To use it, you can either download it and host it yourself or you can just link to a CDN. A lot of people just use a CDN. So, to do that, you just go into HTML file and put this line. So, right within the head tag, you can see we have the head tag here and inside that you're going to put this line script and the source equals and then you just link to the jQuery here, the jQuery CDN. If you can't remember what that is, you can just go to Google and type in jQuery CDN and you can also download it from jquery.com. And if you are creating something on CodePen like I am right now, there is an even easier way to add jQuery. You just go to settings and then on the JavaScript tab, quick add, you go down to jQuery and then you just click save and close and then you you don't even have to put the script here. It adds it for you. So, down the JavaScript code here, I'm going to show you the basic syntax of jQuery. You're always going to start with the a dollar sign and then in parentheses you're going to put a selector. Now, this selector can be any CSS selector. And then you're going to put dot and then you're going to put the action. So, whatever action you're going to have jQuery perform with that CSS selector. So, I'm going to get rid of this. I'm just about to copy and paste some code that has three jQuery commands and what we're going to talk about those. Okay, so here are three jQuery commands. So, this first jQuery command is is kind of special. Uh you're usually going to want to put your entire code in a document.ready event. So, document.ready just means when the document is ready or when the document is completely loaded, then you're going to run the rest of your code. If you don't put your code in a document.ready event, your code may try to access an element from the HTML that has not yet loaded. So, this just selects the document and when it's ready, it runs this code. So, now let's look at the code inside the document.ready event. Again, we start with the dollar sign and then we have a CSS selector, button is just going to select the the button tag right here. And then we're going to add a click action or a click event. So, this is going to be the action click and when the button is clicked, we're going to run the command that's inside that. So, inside we have another jQuery command. You know it's jQuery cuz it starts with a dollar sign and then we're going to select the P tags and we're going to hide them. So, there's two P tags here. You can see these two right here. So, if I click the bell button, the P tags are hidden. I'm just going to reset that and we're going to change the code a little bit. So, I'm just going to change this one right here. I'm going to change this to serial with the hash sign or the pound sign right before this. That's just the CSS selector for ID. So, you can see up here, ID of serial. So, now it's going to select this whole thing right here. So, if we run that and then we click the button, it just hid the paragraph element with the ID of serial. And you can see these two lines, one of them is a has a paragraph tag, one of them has a div tag, but they both have the same class of unicycle. So, if we just use the CSS dot unicycle, that's how you would show a class, the dot. If I click the button, it hides everything that's unicycle. Now, let me show you one more way you can mix this up. Um here, we've been selecting the button to add the click event, but we can also make this H3. So, we can we can really add the click event to anything. And now we're going to hide the button. So, let's see what happens there. When I click the button now, nothing happens. But if I click the heading, the button disappears. Okay, that's just a quick introduction to jQuery. I'm going to be going over more information about jQuery in future videos. Thanks for watching. My name is Beau Carnes. Don't forget to subscribe, and remember, use your code for good.
Original Description
jQuery is a very popular, lightweight JavaScript library. The purpose of jQuery is to make it much easier to use JavaScript on websites. jQuery simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.
Learn the basic syntax in this video.
💻 Code: https://codepen.io/beaucarnes/pen/mwGZre?editors=1010
🐦 Beau Carnes on Twitter: https://twitter.com/carnesbeau
⭐JavaScript Tutorials Playlists⭐
▶JavaScript Basics: https://www.youtube.com/playlist?list=PLWKjhJtqVAbk2qRZtWSzCIN38JC_NdhW5
▶Data Structures and Algorithms: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkso-IbgiiP48n-O-JQA9PJ
▶ES6: https://www.youtube.com/playlist?list=PLWKjhJtqVAbljtmmeS0c-CEl2LdE-eR_F
▶Clean Code: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkK24EaPurzMq0-kw5U9pJh
-
Learn to code for free and get a developer job: https://www.freecodecamp.com
Read hundreds of articles on technology: https://medium.freecodecamp.com
And subscribe for new programming videos every day: https://youtube.com/subscription_center?add_user=freecodecamp
❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp
Playlist
Uploads from freeCodeCamp.org · freeCodeCamp.org · 39 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
▶
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
Dates - Beau teaches JavaScript
freeCodeCamp.org
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
The Definition of Ready - Agile Software Development
freeCodeCamp.org
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
Working Agreement - Agile Software Development
freeCodeCamp.org
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
Definition of Done - Agile Software Development
freeCodeCamp.org
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
The INVEST approach to product backlog items
freeCodeCamp.org
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org
More on: JavaScript Fundamentals
View skill →Related Reads
📰
📰
📰
📰
A tabbed form that silently refused to submit — required fields hidden behind another tab
Dev.to · Susumu Takahashi
The DOM Isn’t Slow. The Way Most Code Talks to It Is.
Medium · Programming
The DOM Isn’t Slow. The Way Most Code Talks to It Is.
Medium · JavaScript
Vanilla JavaScript — Why It Still Matters in the Age of React and Next.js
Dev.to · Osama Abu Motlaq
🎓
Tutor Explanation
DeepCamp AI