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 with Simple Email Validation Plugin Code Challenge

Hi Everyone, I'm having a little trouble with the third challenge in Build an Interactive Website jQuery Plugins Simple Email Validation Plugin. I'm sure it's something inane, but I can't figure it out. The challenge is "On the next line select the "textarea" call "validEmail" and pass in the parameters of "on" set to "keyup", and "success" and "failure" set to empty anonymous functions."

I've tried all of these (seperately, of course)

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

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

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

with no luck. (Anyone who wants to point me to a reminder on how to specify what I'm calling something on is also welcome to, I have a very hard time keeping it straight.)

Thanks in advance for any advice.

Best, A

12 Answers

Oh no! It's right there in the video too. Working perfectly now.

Thanks for the help. I appreciate the energy in the videos and that you pay so much attention to questions in the forum.

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

No worries. Hit us up if you need help or any further explaination.

Okay, I entered ....

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

and received "Bummer! You didn't call 'validEmail' on the selected textarea". Is it something obvious that I am missing?

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

It looks like you missed the $ at the beginning.

Doh! Had a feeling it was something obvious.

Doesn't get more obvious than that :-)

I have got this so far... $("textarea").validEmail({on:"keyup", success:function(){}, failure:function(){}});
what am I missing?

i have windows vista, why?

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Some times Windows inserts special characters at the ends of lines when you hit return or copy and paste which can cause the engine to bork.

Try typing it in character for character and see if it happens again. If it does tell me the error message you get.

I thyped it out and got the error message "Bummer! You didn't call 'validEmail' on the selected text area.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

This is the code I have:

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

It works.

got it. did not have it in the script tag. thanks for the help.

Ed Young
Ed Young
14,340 Points

I have entered:

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

I get the response, "Oops! It looks like Task 2 is no longer passing."

Please advise. Thanks much! (Using chrome on a Mac with Mavericks.)

I found the problem - spacing is critical. Thanks!

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Hi Ed Young

Look closely around failure:().

Regards
Andrew

Ed Young
Ed Young
14,340 Points

Thanks! The dangers of coding late at night! :-)

Ed Young
Ed Young
14,340 Points

Thanks! The dangers of coding late at night! :-)