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!

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 trial


Building An Interactive Website > Form Validation & Manipulation> "Modifying Attributes" BUG

I can't seem to get the span to change color when I type in the email field. I typed it the way Andrew did, but the field just won't respond to my text inputs.

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
    $("#form span").hide();
            //Check all required fields.

            //Check for a valid email.
            if(false) $(this).next().removeClass("error").addClass("valid");
            else $(this).next().removeClass("valid").addClass("error");

Again typed exactly the same way, I just pasted the js part, since that's the part that really matters.

2 Answers

Nick Pettit
Nick Pettit
Treehouse Teacher

Hi Elton Zhang - Healthily,

The only thing I can guess is that jQuery isn't being included properly, or that there's something wrong elsewhere in the code.

I took Andrew Chalkley's example and pasted it into CodePen. I then took your code and pasted it in, and it works just fine. See the example here: http://codepen.io/nickpettit/pen/qALps

Sorry that's not more helpful! I know these types of issues can be frustrating, but as you practice coding more, you'll get better at resolving them quickly. Let me know if that CodePen example does what you were expecting, or if there's something else you're trying to work out.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Hi Nick,

Elton did a support ticket over the weekend. I replied to his email this morning. It should have resolved the issue.

For those who are interested, $("email") is missing the # symbol in front of email as "email" is an invalid selector.

Also Elton if you tag your post with jQuery I'll get notified of it. I've edited the post to have it now.

Regards Andrew

Nick Pettit
Nick Pettit
Treehouse Teacher

That is some top notch detective work. Thanks, Andrew!

Of course it would be something as obscure as a # symbol. Thanks Andrew. I have trouble letting things go, especially with unresolved coding issues, so thanks for helping me get that monkey off my back.