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
Kieran Barker
15,028 PointsI think this challenge is faulty?
Hi, guys! The question is:
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.
This is what I've done:
const $submit = $('.submit-btn');
$submit.attr('disabled', 'true');
...But the code challenge says:
Bummer! Did you supply the arguments "'disabled', true" to the "attr" method call on the variable named "$submit"?
Isn't that exactly what I've done?
2 Answers
David Deberry
5,447 PointsTake true out of quotes and it should work.
Matthew Gilbert
9,817 PointsRemove the ' ' on 'true'
const $submit = $('.submit-btn'); $submit.attr('disabled', true);
Kieran Barker
15,028 PointsKieran Barker
15,028 PointsBut it shouldn't matter, should it?
David Deberry
5,447 PointsDavid Deberry
5,447 PointsIf the true is in quotes then it will be a string instead of a boolean. I believe you have to insert a truth value. It is similar to is you have the following.
It will not print john because name is in quotations. So when you put true in quotations you are passing in a string instead of setting disabled to true.
Kieran Barker
15,028 PointsKieran Barker
15,028 PointsStill... My answer worked when I did it in Workspaces, so it shouldn't be marked wrong.