JavaScript jQuery Basics Working with jQuery Collections Adding/Removing Classes

Kirblue ~
Kirblue ~
8,348 Points

There was an error with your code: Error: Syntax error, unrecognized expression: $submit

It says that there is an unrecognized expression named $submit, even though I declared a variable for it. I don't know if there is a typo or something in my code or the challenge is broken. 🤔

<!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>
var $submit = $('.submit-btn');
Kirblue ~
Kirblue ~
8,348 Points

Nevermind, I found the answer right after I posted this! 😆

1 Answer

Steven Parker
Steven Parker
204,004 Points

For the benefit of other readers, the variable is fine, but it's already a jQuery object and an element selector. Also, you need to provide the value to set the property with:

$submit.attr('disabled', true);