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 trialAndrea Sorrell
4,736 PointsSimple Email Validation Plugin Question
I have tried this and it is not working; I have gone through it twice and still is not working. I lost the "@" validation along with not gaining text input validation. Here is the code I input.
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/validEmail.js"></script><script type="text/javascript">
var $submit = $(".submit input");
var $required = $(".required");
function containsBlanks(){
var blanks = $required.map(function(){return $(this).val() == "";});
return $.inArray(true, blanks) != -1;
}
function requiredFilledIn(){
if(containsBlanks() || !$("#email").validEmail())
$submit.attr("disabled","disabled");
else
$submit.removeAttr("disabled");
}
$("#form span").hide();
$("input, textarea").focus(function(){
$(this).next().fadeIn("slow");
}).blur(function(){
$(this).next().fadeOut("slow");
}).keyup(function(){
//Check all required fields.
requiredFilledIn();
});
$("email").validEmail({on:"keyup", success:function(){$(this).next().removeClass("error").addClass("valid");
}, failure:function(){
$(this).next().removeClass("valid").addClass("error");
}});
requiredFilledIn();
</script>
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsNear the bottom of your code you don't have # in front of email. $("#email").validEmail
...
Andrea Sorrell
4,736 PointsThat was it!. Thank you Jason.