Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build an Interactive Website jQuery Plugins Simple Email Validation Plugin

jQuery Plugins > Simple Email Validation Plugin Code Challenge (4/4)

Hey guys,

I'm have no idea what to do for this task and I'm sitting here literally looking at the screen not knowing how I do this.

In the "success" function add the class of "valid" to the textarea that's had a the "keyup" event triggered

Any help would be greatly appreciated; I'll keep re-watching the video and see if anything comes up.

Thanks,

Stu :)

1 Answer

Jacob Miller
Jacob Miller
12,466 Points

Here's what your code should look like:

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

Inside the success parameter's function, select this and add the class of valid. The function will be triggered automatically on keyup if it's valid because you set the on parameter to "keyup".