Coding Challenge #2 - Live Input Feedback
Key Takeaways
This video demonstrates a coding challenge that focuses on providing live input feedback to users as they enter an email address, utilizing HTML, CSS, and JavaScript. The challenge requires creating a regular expression to detect valid email addresses, coloring the input border green when valid and gray when invalid, and animating a green tick icon next to the input field.
Full Transcript
all right then gang so welcome to your next coding challenge this one is also going to be a ux focused one which needs a little bit of html css and javascript knowledge so again if you don't know much about any of those things maybe try watching my courses on all three of those topics first of all the links to those are going to be down below the video anyway the challenge this time around is to offer some live feedback to a user as they enter an email into this input so whenever we detect that the value of the input is a valid email address we animate the green tick and also color the input border green too then when the value becomes invalid again we animate out the green tick and the border goes gray again so in this challenge there's three key things that you really need to focus on the first one is being able to detect whether the value inside the import is a valid email address whenever a user presses a key inside it and for that you're going to need to use a regular expression now i'm going to leave a link to a tutorial on my youtube channel all about how to make a regular expression for an email address so feel free to reference that to help you out the second thing you need to figure out is how to color the border of the input field when we have a valid email then change it back to gray when it's not valid again and the third thing you need to solve is how to animate in this tick icon next to the import when we have a valid email address and then animate it back out when it's not valid anymore so i think this challenge is going to combine a few different problems that you have to think about which is nice and by the way i don't want you to rely on the standard browser form validation by using the email type input and the required attribute for this problem because i want you to be able to think about how to solve it using your own logic and then offer your own live feedback to the user like this green tick right here now i'm going to start you off with a starter project which looks something like this it's just a form field on the page with no extra validation or anything like that and when we enter an email address into this we don't get any kind of live feedback to say that it's valid so your job is to take it from this point to the final product which is this that i just showed you so the starter project is on this repo on github coding challenges again the link is going to be down below and in order to get it you need to select from the branch drop down challenge to start and then you can download this project by clicking on the code button and then downloading a zip folder so once you've downloaded that folder you want to extract all so we can access the project folder and that should just take a second and then this is the folder right here we want to open up inside vs code so let's do that as well and here we go this is the starter project so let me just quickly walk you through this it's dead simple so first of all we have an index.html file and inside there we have a head and we have a link to this thing right here which is a google fonts and it's for material icons now the reason we're loading that in is so that we can use material icons down here to get the tick icon so if we want to use one of these icons then all we have to do is give something a class of material icons like so and then whatever the icon name is each icon has its own class and you can look that up by just googling google material icons all right so we load that in first of all then we have our own style sheet which we'll take a look at in a second and then a title now down here in the body dead simple we just have a form then we have a div with a class of field for the form field the field has a label right here that says enter your email then the input is a type of text and then a name of email and an id of email so remember i said don't use type email for this challenge because that's going to enable some browser validation when you submit a form now what i want you to do is practice your live validation so as a user is typing into the input field then we can kind of validate the email now you can use email and do that if you want to as well i just wanted to kind of make it clear that all of this validation logic is going to be your own all right so then after that we have this tick icon right here as well and then at the bottom we have this script linking to index.js so this is where all of your logic is going to live now inside index.css we just have some base styles right here so the body we give a background of a very light gray text align center font size 1.4 amps just to make things a bit bigger and a font family of vadana then the form itself we give a background of white a margin of 200 pixels top and bottom also left and right and then a padding of 20 pixels all the way around border radius of 10 pixels just to soften up the form box display is inline block and then after that we say form and the field inside that so this div right here we say displays flex so that each of these things sits next to each other all right left to right and then align items center all right then so after that we have the form input and we give that a margin of zero top and bottom 16 pixels left and right and that's just going to spread it out from this on the left and this on the right and then the border is two pixels solid and a gray color border radius four pixels just to soften the corners and then a padding of four pixels so that's all the base styles your solution styles can go down here now what i'd like to do is preview this in a browser and remember to do this i'm using the package live server which you can search for up here by typing live server like so and it's going to hopefully show up it's this package you need to install when you do that you can right click over here and we can open this up in a live server it's going to open in the browser for you and this is the starter project right so as you can see there's no validation in place and we'll just type in any old email address we always get the tick it's not going green so i want you to get from this to the end point which i showed you before and remember that looks something like this so to begin with the tip doesn't show but as i start to type in an email mario net ninja dot dev when it becomes valid we get that tick animating in this goes green and then when i start to delete and it's no longer a valid email address the tick goes away and the border goes great again so this is your end goal right here this is what you're aiming for so give this a good go and i'm going to post my solution tomorrow
Original Description
🐱💻 Access the course files on GitHub:
https://github.com/iamshaunjp/Coding-Challenges
🐱💻 Modern JavaScript Course:
On Net Ninja Pro - https://netninja.dev/p/modern-javascript-from-novice-to-ninja
On YouTube - https://www.youtube.com/watch?v=iWOYAxlnaww&list=PL4cUxeGkcC9haFPT7J25Q9GRB_ZkFrQAc
🐱💻 HTML & CSS Crash Course:
On Teachable - https://net-ninja-pro.teachable.com/p/html-css-crash-course
On YouTube - https://www.youtube.com/watch?v=hu-q2zYwEYs&list=PL4cUxeGkcC9ivBf_eKCPIAYXWzLlPAm6G
🐱💻 VS Code - https://code.visualstudio.com/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Net Ninja · Net Ninja · 0 of 60
← Previous
Next →
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
GraphQL Tutorial #5 - Express App Setup
Net Ninja
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
GraphQL Tutorial #8 - Root Query
Net Ninja
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
GraphQL Tutorial #12 - Author Type
Net Ninja
GraphQL Tutorial #13 - Type Relations
Net Ninja
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
GraphQL Tutorial #18 - Mutations
Net Ninja
GraphQL Tutorial #19 - More on Mutations
Net Ninja
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
GraphQL Tutorial #23 - Create React App
Net Ninja
GraphQL Tutorial #24 - Book List Component
Net Ninja
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
GraphQL Tutorial #28 - Add Book Component
Net Ninja
GraphQL Tutorial #29 - External Query File
Net Ninja
GraphQL Tutorial #30 - Updating Component State
Net Ninja
GraphQL Tutorial #31 - Composing Queries
Net Ninja
GraphQL Tutorial #32 - query variables
Net Ninja
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
GraphQL Tutorial #34 - Book Details Component
Net Ninja
GraphQL Tutorial #36 - Styling the App
Net Ninja
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
Updated Vue & Firebase Course (Udemy)
Net Ninja
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja
More on: JavaScript Fundamentals
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Next.js vs Remix vs SvelteKit: Which Framework Should You Learn?
Dev.to · Etrit Neziri
Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Medium · JavaScript
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · Programming
10 Frontend Developer Tools to Boost Productivity in 2026
Medium · JavaScript
🎓
Tutor Explanation
DeepCamp AI