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.

<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet" href="style.css">
    <button type="submit" class="submit-btn">Submit If You Can</button>

    <script src="app.js"></script>
const $submit = $('.submit-btn');
$submit.attr('disabled', 'true');

1 Answer

Jennifer Nordell
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: