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
Giuseppe Elia Brandi
Front End Web Development Techdegree Graduate 69,630 PointsNeed help on the following: Simple Email Validation Plugin 4/4
Good day all,
Can somebody help me out with this code challenge? :
In the "success" function add the class of "valid" to the textarea that's had a the "keyup" event triggered
Frankly I have no idea how to handle this exercise.
Thank you for your co-operation.
<!DOCTYPE html>
<html>
<head>
<title>Plugin</title>
<style type="text/css">
.valid {
color: green;
}
</style>
</head>
<body>
<p>
<input type="text" value="andrew@teamtreehouse">
</p>
<p>
<textarea>andrew@teamtreehouse.com</textarea>
</p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="validEmail.js"></script>
<script>
var isValid = $("input") .validEmail();
$("textarea").validEmail({on:"keyup", success:function(){
$this.next().removeClass("error").addClass("valid");
}, failure:function(){
$(this).next().removeClass("valid").addClass("error");
}});
requiredFilledIn();
</script>
</body>
</html>
1 Answer
Giuseppe Elia Brandi
Front End Web Development Techdegree Graduate 69,630 PointsSolved!! Just in case for future references... I just needed to copy and paste the same code and change one parameter!
$(".valid").validEmail({on:"keyup", success:function(){ $this.next().removeClass("error").addClass("valid"); }, failure:function(){ $(this).next().removeClass("valid").addClass("error"); }}); requiredFilledIn();