Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialwilliamrossi
6,232 PointsJquery basic keyup
"On line 51 on app.js, use the focus and keyup event handlers to execute the confirmPasswordEvent."
I don't even know where to begin with this one, I get lost in all the functions!
//Problem: Hints are shown even when form is valid //Solution: Hide and show them at appropriate times var $password = $("#password"); var $confirmPassword = $("#confirm_password");
//Hide hints $("form span").hide();
function isPasswordValid() { return $password.val().length > 8; }
function arePasswordsMatching() { return $password.val() === $confirmPassword.val(); }
function canSubmit() { return isPasswordValid() && arePasswordsMatching(); }
function passwordEvent(){
//Find out if password is valid
if(isPasswordValid()) {
//Hide hint if valid
$password.next().hide();
} else {
//else show hint
$password.next().show();
}
}
function confirmPasswordEvent() { //Find out if password and confirmation match if(arePasswordsMatching()) { //Hide hint if match $confirmPassword.next().hide(); } else { //else show hint $confirmPassword.next().show(); } }
function enableSubmitEvent() { $("#submit").prop("disabled", !canSubmit()); }
//When event happens on password input $password.focus(passwordEvent).keyup(passwordEvent).keyup(confirmPasswordEvent).keyup(enableSubmitEvent);
//When event happens on confirmation input fun $confirmPassword.keyup(enableSubmitEvent);
enableSubmitEvent();
On line 51 on app.js, use the focus and keyup event handlers to execute the confirmPasswordEvent.
17 Answers
rd. ln.
7,851 PointsThis is incredibly confusing. Actually the entire jQuery module was very very difficult to listen to.
Dylan Hobbs
9,279 PointsHi Will R,
This one gave me some trouble also but I figured it out.
If you go on line 51 you'll see it says $confirmPassword.keyup(enableSubmitEvent);
What you need to do is add in the focus handle to target the confirmPasswordEvent
Then you will need to use the keyup handle to bind it
So the complete code should look like
$confirmPassword.focus(confirmPasswordEvent).keyup(confirmPasswordEvent);
Cheers!
Josephine Mukuya
5,911 Pointsthankyou guys,i thot it was just me,,so far jquery has proved to be the most diff ,,,its the teacher approach i guess,,
N. Suzanne McLarnon
Courses Plus Student 9,842 PointsI passed this challenge with
$confirmPassword.keyup(enableSubmitEvent).focus(confirmPasswordEvent).keyup(confirmPasswordEvent);
It is more readable like so:
$confirmPassword.keyup(enableSubmitEvent);
$confirmPassword.focus(confirmPasswordEvent);
$confirmPassword.keyup(confirmPasswordEvent);
The exercise is just making sure that whenever the Confirm Password box is either in focus OR the user is typing, the confirmPasswordEvent is being triggered (to compare the password fields and enabling/disabling whether the user can submit).
Jerôme Naglé
14,189 Pointsthe answer is.. add this code before line 51.
$confirmPassword.focus(confirmPasswordEvent).keyup(confirmPasswordEvent).keyup(passwordEvent).keyup(enableSubmitEvent);
Shawn Benn
8,070 Pointsyeah going to youtube to re-learn jquery idk whats going on in this entire module
-_-
williamrossi
6,232 PointsThanks for the messages, still stuck on this one. what is the answer, I've spent ages trying lol. Maybe seeing it will connect the dots!
Jessica Jimenez Hageman
7,670 PointsThank you! I also had trouble with this one.
Panos Papanik
8,273 Pointsso long, unfortunately for me, jquery lessons are the worst. don't know, maybe is my bad
Ian Friedel
11,960 PointsThanks Patrick Mockridge! I will keep working on it and I think it should make more sense. Using jQuery I am understanding the JavaScript concepts easier for sure.
Thanks!
Andrew Lincoln
1,732 PointsI can't identify line 51 here. Which function are you having a challenging with?
tcotp
20,039 PointsThe challenge wants you to use the "confirmPasswordEvent" on line 51 with both the focus and keyup event handlers. Compare the event that is selected in the code to what you are told to target for the challenge and then work on using both focus and keyup on that line of code.
roselio marcial
3,927 Pointsthx for the answer i also feel stupid on this module hard to understant everythong that is going on
Ian Friedel
11,960 PointsGlad that I am not the only one that thinks the jQuery lessons made no sense. I finished JavaScript basics and was feeling good going into jQuery and feel as though jQuery is WAY MORE CONFUSING. The lessons jumped around and made a simpler version of JavaScript feel 10 times harder. I loved the code challenges with JavaScript forcing you to understand the information but with jQuery they are telling you exactly what to put into the code and where, so it is basically useless. Please update the videos for jQuery so that we can learn a great language and be ready for real coding challenges in the future.
Patrick Mockridge
Full Stack JavaScript Techdegree Graduate 45,611 PointsThe good news is that once you start using it, it makes life a whole lot easier. It's a very self-explanatory language when you're traversing the DOM for any real world projects you'll see what I mean.
ester gabetta
8,948 PointsWorst teacher ever on treehouse...... I started studying JQuery on treehouse two years ago, and I felt so dumb after every video... Now I'm trying again after I got more experience.. But the problem it's me (ok, I'm not so smart probably), but the second problem is this teacher... PLEASE CHANGE THIS COURSE'S TEACHER!!!!!!
Darren Ward
12,025 PointsThis is so confusing. The teacher doesn't really explain the specific terms he is using then jumps around all over the place.
Devorah Brinson
7,490 PointsI believe it is asking you to replace the (enableSubmitEvent) in confirmPassword.keyup(enableSubmitEvent) with the confirmPasswordEvent.
Patrick Mockridge
Full Stack JavaScript Techdegree Graduate 45,611 PointsI see what Chalky is trying to do with this module, I just think it's a bridge too far. It's an ambitious scope but it could do with more time being spent on the fundamentals. Not as ridiculous as when Jason jumps straight into Ruby on Rails though. I think part of me actually died when he did that.
williamrossi
6,232 Pointswilliamrossi
6,232 PointsAgreed!
Tyler Mayfield
16,291 PointsTyler Mayfield
16,291 PointsI agree, I feel like the jQuery stuff isn't explained very well and we are just thrown into it.
Alin Marginean
10,177 PointsAlin Marginean
10,177 PointsThis jQuery course made me feel dumb.
Noah Huynh
1,660 PointsNoah Huynh
1,660 PointsDid you take the JS module? If not I would recommend it because of the concepts but I understand how you feel because I struggled a bit too. Hopefully they will restructure the jquery lessons.
Brian Mendez
7,734 PointsBrian Mendez
7,734 PointsI totally agree. Instructor jumped everywhere and I felt like I hardly learned anything.
carolynt
7,502 Pointscarolynt
7,502 PointsI thought I was the only one who felt this way. I was so excited for jQuery, and this module is ruining it for me. I was getting so frustrated and annoyed at him. I'm dreading any other lesson he teaches.
Anusha Lee
Courses Plus Student 14,787 PointsAnusha Lee
Courses Plus Student 14,787 PointsI thought I was the only one who felt frustrated, and I still have a hard time to comprehend. But I still hope I can figure jQuery out....
Andrew Biviano
6,748 PointsAndrew Biviano
6,748 PointsTotally agree, not much active teaching more...here's how you look it up!
Rich Braymiller
7,119 PointsRich Braymiller
7,119 PointsPheww I am so glad I'm not the only one who feels like this. Like others, I was so excited to start jQuery but this instructor talks fast, doesn't really explain what's going on clearly at all and is just all over the place. They just need to redo it with a different instructor and/or format. Hopefully code academy or something has a better jQuery course. I'm basically going through it just to go through it which isn't helpful at all....
Tyler Prosper
1,718 PointsTyler Prosper
1,718 PointsI'm glad I'm not alone. I also found the jQuery section to be especially poorly explained. Many complicated concepts were glossed over and never clarified.
Stephen Limmex
32,604 PointsStephen Limmex
32,604 PointsI am in agreement with the previous comments that there is room for Team Treehouse to raise the bar on this jQuery module. What is disappointing is that the initial comments here are from Q1 2015 and those of us who are going through the module a year later in Q1 2016 are providing Team Treehouse with the same feedback.
I take detailed notes on the videos and Print Screens for my future reference. My notes on this jQuery module are not nearly as well detailed as my notes on HTML, CSS, and JavaScript.
Thankfully much of the informaton needed is available at http://api.jquery.com/.
Anusha Lee
Courses Plus Student 14,787 PointsAnusha Lee
Courses Plus Student 14,787 Pointsi stopped learning jQuary and started JavaScript (from other source) about one month ago. Still struggled with JS concepts but, luckily, i can get comprehend the whole thing gradually. Then I got back to jQuary and i found it has become easier. i found this on learn.jquary.com. So perhaps it's better to start JS before jQuary.
http://learn.jquery.com/about-jquery/ One important thing to know is that jQuery is just a JavaScript library. All the power of jQuery is accessed via JavaScript, so having a strong grasp of JavaScript is essential for understanding, structuring, and debugging your code. While working with jQuery regularly can, over time, improve your proficiency with JavaScript, it can be hard to get started writing jQuery without a working knowledge of JavaScript's built-in constructs and syntax. Therefore, if you're new to JavaScript, we recommend checking out the JavaScript basics tutorial on the Mozilla Developer Network (MDN).
hope it helps.
Frank Bono
2,911 PointsFrank Bono
2,911 PointsAbsolutely!
Learning coding
Front End Web Development Techdegree Student 9,937 PointsLearning coding
Front End Web Development Techdegree Student 9,937 PointsI didn't made a comment about how he teaches because I allready feel dumb a lot of the time here. So I was not sure if it was me. This teacher can be clearer in what he teaches and he talks with an accent. This made me go to the transcripts more than needed. But he obiously has a lot of skills, I hope to get near that soon.