JavaScript jQuery Basics Working with jQuery Collections Adding/Removing Classes

Seth Pabst
Seth Pabst
7,673 Points

What's wrong with my code I can't figure this out??

It says strict mode won't allow implicit creation of global property '$submit'

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
$submit = $('.submit-btn');
$submit.attr('disabled', true);

1 Answer

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,939 Points

Implicit creation of global property '$submit' means the variable $submit wasn't declared. You need to use const or var to do so. See this video @ 3:49 for an example.