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

Brian Schmitz
Brian Schmitz
11,167 Points

Help with adding the validEmail plugin please. Thank you!

<script> var isValid = $("input.text").validEmail({on:"keyup", success:function() { $(this).next().removeClass('error').addClass('valid');
}, failure: function() { $(this).next().removeClass('valid').addClass('error'); }); </script>

1 Answer

Hi Brian,

You have added more code than requested in the challenge and it doesn't look like you are selecting the textarea element.

This was what I passed with:

var isValid = $('input[type="text"]').validEmail();
$("textarea").validEmail({on:"keyup",
                              success: function() {
                                $(this).addClass("valid")
                              }, failure: function() {
                              }
                             });
Brian Schmitz
Brian Schmitz
11,167 Points

Thanks Jason, appreciate the help.