Question about dividing files

Hi-

I’m getting the following error in the console when I load my page:

logic.js:5 Uncaught TypeError: document.ready is not a function
    at logic.js:5

Here is the code in my “logic.js” file:

(document).ready(function(){
  $("#title").html("NEW TITLE");
});

Here is my html file:

<html>

<head>

<title>Randy on Tech</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script src="logic.js"></script>

</head>

<body>
<h1 id="title">OLD TITLE</h1>

</body>


</html>

Can anyone see where I’ve gone wrong?

Thanks!

Hi @Flaflaflohi,

Thanks for reaching out to us. I believe you missed out the dollar sign in front of the document parentheses.

Try appending the selector symbol "$" as shown below.

$(document).ready(function(){
  $("#title").html("NEW TITLE");
});

Hope this solves the issue.

Happy Learning :slight_smile:

2 Likes