Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


[HELP] Code Challenge: Simple Email Validation Plugin 2/4

Hello, I am stuck here. could you help me to figure this out?

I tried this (did not work) ;

<script type="text/javascript"> function isValidEmail(){ if $("input").validEmail() $isValid = $("input"); }); </script>

Then I tried this (did not work);

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

I really don't know what I am supposed to do...

3 Answers

31,206 Points

On step 2/4, according to the directions you should put:

<script type="text/javascript">
     var isValid = $("input").validEmail();

Just looks like you were getting ahead of yourself, but good work.

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

Y H,

Sam is right. I think you're supposed to just call the validEmail function; later steps in the code challenge ask you to fill in the argument with <code>{on: ..., success: ..., failure: ...}</code>. When it gets to that point, don't forget to include an anonymous function for <code>failure:</code>, as I don't think that's optional for this code challenge; it doesn't look like you included that in your code above.



Oh thank you so much for your help Sam and J.T.! I was thinking too much and also mixed the variable sign with php.

Thank you again!