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

JavaScript

[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

samiff
samiff
31,206 Points

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

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

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.

Best,

J.T.

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!