JavaScript jQuery Basics Working with jQuery Collections Adding/Removing Classes

Zahra El Faquir
Zahra El Faquir
6,723 Points

I don't see what is wrong with this code: const $submit = $('.submit-btn'); $submit.attr('disabled', 'true');

The goal is to select the submit button with the class "submit-btn" and add a "disable" attribute. I can't figure out why I get an error message, I'm sure I'm missing something.

index.html
<!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>
app.js
const $submit = $('.submit-btn');
$submit.attr('disabled', 'true');

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! You're really close here, but you're passing in the string "disabled" which is correct, but it's expecting the boolean value true. You're passing in the string value of 'true'. Eliminating the single quotation marks from around 'true' causes this to pass the first step.

Hope this helps! :sparkles: