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 trial


Adam Soucie
Adam Soucie
Courses Plus Student 8,710 Points

JQuery Plugins: Simple Email Validation Plugin Challenge 3 of 4

I'm getting an error that doesn't make sense. According to the code engine, after passing Task 2, my code breaks it in Task 3. Please help.

<script type="text/javascript">
    var isValid = $("input").validEmail();
    var isValid2 = $("textarea").validEmail(on:"keyup", success:function(){}, failure:function(){});

I've tried it both with and without assigning the value of the second validEmail() call to a variable, and get the same error. At this point, I don't know what I'm doing wrong.

4 Answers

J.T. Gralka
J.T. Gralka
20,126 Points


Don't forget that the hash that you pass through as an argument to the validEmail() method, should be encapsulated in curly braces! You're passing through one argument to the method, not three separate ones.

The way you have it:

$("textarea").validEmail(on:"keyup", success:function(){}, failure:function(){});

Notice that your version of the code omits curly braces. If you rewatch the Simple Email Validation Plugin video again, you might notice that Andrew puts his on:, success:, and failure: arguments into an option hash surrounded by curly braces.

Let me know if that doesn't fix your issues, or if any of my explanation is unclear to you.



Adam Soucie
Adam Soucie
Courses Plus Student 8,710 Points

JT, that makes perfect sense. I completely missed the extra curly braces, both here and when I watched the original video. Thanks!

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Glad J.T. chimed in!

Semi colons, single equals, missing curly braces and brackets are always a problem!

Some of most fun and effective times I've had developing is pair programming because you catch each others missing syntax and you can learn a lot too.

Regards Andrew

Thanks! Finally got this passed. The curly brackets are sneaky!