Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Did you make a call to the "addClass" method after calling the "attr" method on the variable named "$submit"?

Challenge Task 2 of 2

The submit button is now disabled, but it doesn’t look like it! Luckily, we have a class called disabled in our CSS that will style it for us. Chain the appropriate jQuery method to add the class of disabled to the submit button.

Bummer: Did you make a call to the "addClass" method after calling the "attr" method on the variable named "$submit"?

my code : const $submit = $('.submit-btn'); $submit.attr("disabled", true) $submit.addClass(' disabled')

what is wrong here?

1 Answer

Tim Knight
Tim Knight
28,863 Points

Ahmed,

I'm not sure about the specific challenge you're on since I'm not sure the course you're taking here, but have you tried chaining the method calls together? Something like, this:

const $submit = $('.submit-btn'); 
$submit.attr("disabled", true).addClass("disabled");