I would like to access html-objects in a html file from a js file with JQuery like it is described in w3schools.
I have these two files:
test.html
<!DOCTYPE html>
<html>
<head>
<title>Beispiel Titel</title>
<script type="text/javascript" src="test.js" ></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
</head>
<body>
<div id="test"> dummy </div>
<!-- <script>
$('#test').text("huhu");
</script> -->
</body>
</html>
and test.js
$(document).ready(function(){
$('#test').text("huhu");
});
If I uncomment the snippet inside the html file it works. But why it do not work from the js file?