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!
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
Dan Gaish
4,285 PointsSimple Email Validation Code Challenge - Stuck
Hi All,
I'm stuck on the second step of the Simple Email Validation Plugin code challenge in the jQuery Plugins module by Andrew.
The challenge says "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."
Using the video and the readme on the GitHub page for Andrew's plugin, I've written:
<script>
var isValid = $(input).validEmail();
</script>
I think this should work as it should evaluate the contents of the <input> and return a boolean as per the readme and the video. However, I'm getting the error "The validEmail method wasn't called on input". I've tried a few variations, but can't get anything to work. Am I missing something, or is it a bug with the code challenge?
Many thanks,
Dan
P.S. Sorry if this has been asked before, but there doesn't seem to be a search on the forum...
6 Answers

James Lister
6,569 PointsI've put in the same code as far as I can see but it won't work? <script> var isValid = $("input").validEmail(); </script>
What is going on here?

Dan Gaish
4,285 PointsNevermind - schoolboy error! :-)
I forgot the quotes.
$("input")

Andrew Chalkley
Treehouse Guest TeacherGlad you got it!

James Lister
6,569 PointsOh my gosh, that sparked something in my brain... in task 1 I had <script type="text" src ="validEmail.js"></script> which passed... but then in task 2 I added /javascript after "text" and it worked! Thanks again!

Alessandro Elkan
Courses Plus Student 7,447 PointsI have the same problem... I don't know whats going on
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="validEmail.js">
var isValid = $('input').validEmail();
</script>

Andrew Chalkley
Treehouse Guest TeacherYou're almost there.
If the src attribute is defined you cannot put code inside it. If you create another script tag and put the code in you'll be fine:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="validEmail.js"> </script>
<script type="text/javascript">var isValid = $('input').validEmail();</script>

Alessandro Elkan
Courses Plus Student 7,447 PointsThanks Andrew, I hope I become as good as you are in javascript!!
Andrew Chalkley
Treehouse Guest TeacherAndrew Chalkley
Treehouse Guest TeacherCan you share your full code?