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 trialVladimir Plokhotniuk
5,464 PointsjQuery basic
Select the submit button by its class and save it to a variable called $submit. Then use the appropriate jQuery method to disable the button by adding a disabled attribute to it. help me with the answer pls. Why site havent it for showinh??!
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button type="submit" class="submit-btn">Submit If You Can</button>
<script
src="jquery-3.2.1.min.js"></script>
<script src="app.js"></script>
</body>
</html>
const $submit = $('.submit-btn').attr('disabled')
3 Answers
Mike Hatch
14,940 PointsFor me, it required two different lines of code to pass. Natalie gave you part of the missing code, but then try cutting the first line in half. First declare the variable on one line, and then add the method on the second line. (Don't forget to insert semicolons.)
Mike Hatch
14,940 PointsYou're welcome. I hope you were able to pass.
Natalie Cluer
18,898 Pointstry setting "disabled" to true:
const $submit = $('.submit-btn').attr('disabled', true);
Vladimir Plokhotniuk
5,464 Points'Did you declare a variable for the jQuery object with an argument of ".submit-btn"?' ... it says
Vladimir Plokhotniuk
5,464 Pointsthank you all for your help
Gremyko Coleman
9,756 PointsGremyko Coleman
9,756 PointsHey, Vladmir, if you still need help on this one, you create the $submit variable and set it = to select the $(".submit-btn"). then you call it and add the .attr() method to.
const $submit = $(".submit-btn"); $submit.attr("disabled", true);