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 trialMary Chadwick
10,683 PointsProblems with task 3 in Form Validation and Manipulation challenge
This is in Building an Interactive Website. I got the first two, but third is not working. Here's what I did:
$("input, #email").addClass("valid"); $("input, #name").removeClass("error"); $("input, #accept").addAttr("checked", "checked");
Do I need to add a var for checked? Line three is failing.
I also tried $("input, #accept")checked.attr("checked", "checked");
$("input, #email").addClass("valid");
$("input, #name").removeClass("error");
$("input, #accept").addAttr("checked", "checked");
<!DOCTYPE html>
<html>
<head>
<title>Modifying Attributes</title>
<style type="text/css">
.valid {
color: green;
border: 2px solid green;
}
.error {
color: red;
border: 2px solid red;
}
</style>
</head>
<body>
<p>
<input type="text" class="error" id="name" value="Andr00">
</p>
<p>
<input type="text" id="email" value="andrew@teamtreehouse.com">
</p>
<p>
Accept conditions <input type="checkbox" id="accept">
</p>
<p>
<input type="submit" value="Submit" disabled="disabled" id="submit">
</p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
1 Answer
Mary Chadwick
10,683 PointsI figured this out for myself. No need for help.