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 Build an Interactive Website jQuery Plugins Simple Email Validation Plugin

SL Starr
SL Starr
17,543 Points

Task two troubles with email validation!

Hi Guys! I've been banging my head against task two for a while now Stage 3 of build an interactive website, jquery plugins email validation task two of the challenge. The challenge is....

"Open a new script tag and using the "validEmail" plugin, store in a variable "isValid" whether the email address in the text input is valid."

I tried

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

which I thought was beautifully simple but get back "you did not call .validEmail on input"

so I tried

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

but get back "null"

any tips would be greatly appreciated.
As an aside, I have gone through the prior JS intros repeatedly but still feel woefully unprepared to keep up with Chalkley, any suggestion on other resources to better prepare for this portion of the track?!

Your wisdom is greatly appreciated!
SL

2 Answers

Double check the way you are creating a new variable in your javascript - specifically isValid.

Just incase you continue to get stuck:

<script> var isValid = $("input").validEmail();</script>
SL Starr
SL Starr
17,543 Points

Wow, kudos to Travis Neiderhiser. This was a heartbreaker. Unless I am mistaken he specifically states he prefers to notate his jquery related variables with a $ lead in as convention which was why I was using the $ sign. Ahhhh, the details! Thanks a bunch for your help!