JavaScript jQuery Basics Working with jQuery Collections Adding/Removing Classes

kingdavid igbayilola
kingdavid igbayilola
8,678 Points

jquery

My code is correct but still getting an error

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);

$submit.addClass('disabled');

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 84,422 Points

The code is technically correct. It'll do the job but the challenge requires you to chain the methods into one line. So...modify the code so that the addClass method runs directly after the attr method using a dot/period to separate them. :-)