Welcome to the Treehouse Community
Looking to learn something new?
What is and where in this lesson is the name of the attribute that we are changing to disabled?
I am asking about disabling the submit button
<!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>
var $submit = ('.submit-btn'); $submit.attr("disabled");
Jennifer NordellTreehouse Teacher
Hi there! Your code is actually really close, but you forgot the
$ sign before the selector so it never became a jQuery object. Otherwise, that selection would have been spot on. It asks you to change the
disabled attribute of a button to
false. There is no example in this video that I can find of that particular attribute on that particular type of HTML element. You will not find an example for every possible attribute of every possible HTML element. Instead, they are counting on you to extrapolate information from the previous examples in the video. In the video a link to a PDF file was selected and the "download" attribute was set to
true. You can find this at 0:57 of the preceding video.
This challenge wants you to not select a link but rather a button and set the attribute to
false. Many HTML elements have default values for attributes. A button's default
disabled attribute is false. Otherwise, every button you wrote would be disabled by default and that seems less than ideal.
So in this challenge I would do:
// This selects the button with the "submit-btn" class and makes it into a jQuery object var $submit = $('.submit-btn'); // This sets the disabled attribute to true. The button is now disabled $submit.attr("disabled", true);
Hope this helps!
Good answer.Thank you. What I had trouble with was the fact that disabled is a Boolean attribute which are handled differently as in your example. Not sure how far back I had to go to find an example.