Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
My HTML code not picking up local javascript file

I was following a tutorial which uses a js file to make a static page dynamic and I typed everything verbatim but my page stays static when I open it with my browser. I have the HTML file and js file in the same directory.

JS AND HTML FILE

//some great message options
const vibes = [
    "... and you are awesome!",
    "... have an amazing day!",
    "... love to see you win!",
    "... can't wait to see what you accomplish today!",
    "... You got this!"
];

var vibe = vibes[Math.floor(Math.random() * Math.floor(vibes.length))];

// diplay a good vibe
document.querySelector(".vibe").append(vibe);
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>A page for you</title>
    <style>
        body{
            text-align:center;
        }
        div.container{
            width: 400px;
            margin: 0 auto;
        }
        .love{
            font-size: 4em;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>This is a page for you</h1>
        </div class="vibe">You are great!</div>
        <div class="love">
            ❤️
        </div>
    </div>
    <script type="text/javascript" src="vibe.js"></script>
</body>
</html>

How can I get the html file to pick the js script and randomize the messages?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Fix this;

 </div class="vibe">You are great!</div>

it should be

<div class="vibe">You are great!</div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!