Difficulty linking JS/ jQuery file to html

Hi,

I’m trying to link the jQuery file “commands.js” to the html file “blocks.html” but am having trouble. I believe my script for jQuery is correct as
I’m not sure if I have to add to link the “commands.js” which is a separate js file. When I do, it doesn’t get linked.

Please tell me what I’m doing wrong.

Thank you,

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script src="jquery-3.5.1.min.js"></script>

    <!-- <script>

    $(document).ready(function(){//waits for the document to load

        alert("OK");

    });

    </script> -->

    <script>

        $(document).ready(function(){

        $("button").click(function(){

            $("h1").fadeOut;

            $("h2").fadeOut;

        });

    });

    </script>

    <title>JQuery</title>

</head>

<body>

    

    <h1>H1</h1>

    <h2>H2</h2>

    <button>button</button>

    

</body>

</html>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.