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

Could Someone Please Give Me a Hand With This Error: " Uncaught TypeError: undefined is not a function"

Hey guys,

So I'm building a form that features the form/email validation that Andrew Chalkley built in a early Treehouse video for the "Smells Like Bakin'" project. I've been able to implement it fine with other projects but for the site I'm currently building I keep getting the error: " Uncaught TypeError: undefined is not a function"

Here's the code block that seems to be throwing this error:

$("#email").validEmail({on:"keyup", success:function(){
    console.log('Code now works!');
    $(this).next().removeClass("error").addClass("valid");
}, failure:function() {
    $(this).next().removeClass("valid").addClass("error");
}});

Any advice on how I can get this working would be greatly appreciated!

Cheers

Stu :)

1 Answer

I do not believe that validEmail() is a method of jQuery's, so, unless you have created a jQuery plugin for it, it is not going to work. Alternatively, the problem could be that you forgot to add jQuery to the page or have a typo in the script tag, but I am thinking my first suggestion is your problem.