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

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".