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

JavaScript jQuery Basics Working with jQuery Collections Adding/Removing Classes

Adam Wieckert
Adam Wieckert
6,834 Points

Adding .attr('disabled')

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 disabledattribute to it.

var $submit = $('.submit-btn'); $submit.attr('disabled');

var $submit = $('.submit-btn'); $submit.attr('disabled', 'true');

How are either of these incorrect. I cannot see it

1 Answer

victor cooper
victor cooper
6,436 Points

You typed $submit.attr('disabled', 'true'); the second argument you typed is surrounded in quotes, that makes it a string and not a boolean. Try this $submit.attr('disabled', true);

Adam Wieckert
Adam Wieckert
6,834 Points

Interesting setting the attribute download="true" worked to cause a link to download. So I figured that was how you must add boolean values to HTML. Must have been a coincidence that the download attribute still functioned.

Thank you for the help!