Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

86
Visualizações
Live server isn't running scripts

I'm on chrome on a Mac, and the index file runs but the script doesn't change anything. I tried just removing paragraphs and that doesn't work either. I tried hard refreshing and running from the Live extension.

This is the code from Index.html

<!DOCTYPE html>
 
<html>
    <head>
        <h1> I've a lot of things to do today.</h1>
    </head>
    <body>
        <p> 1. Get the litter & Wet Food.</p>
        <p> 2. Clean the Room.</p>
        <p> 3. Go out with the girlfriend.</p>
        <p> 4. Teach Rishabh.</p>
        <p> 5. Watch a show.</p>
        <p> 6. DON'T GET ANYMORE NFTS SER.</p>
        <script scr="scripts.js"></script>
    </body>
</html>

and scripts.js

let ps = document.querySelectorAll('p')
ps.forEach(function(p){
    p.remove()
})

The script isn't called at all because even a simple console.log statement in the scripts.js file won't run. No errors either :/

Thanks a lot for the help. I'm super new and this has been kinda frustrating.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Everything is perfectly Fine, but I would say you to not to use the h1 in the head tag.

  • The problem with the snippet provided is that there is a typo in the source definition of the script!
  • Use the correct definition for the source src in place of the scr.
<script src="script.js"></script>
about 4 years ago · Juan Pablo Isaza Relatório

0

You can't write h1 like this in head, head is used for meta-data, link, and other things to configure html page before loading. If you want, you can set a title in head to replace your h1 or move your h1 in your body. Rest of your content should be in body.

Edit : And you have a spell error, it's src not "scr" for import your script !

<html>
  <head>
    <title>To Do Page</title>
  </head>
  <body>
    <h1>I've a lot of things to do today.</h1>
    <p>1. Get the litter & Wet Food.</p>
    <p>2. Clean the Room.</p>
    <p>3. Go out with the girlfriend.</p>
    <p>4. Teach Rishabh.</p>
    <p>5. Watch a show.</p>
    <p>6. DON'T GET ANYMORE NFTS SER.</p>
    <script src="./scripts.js" type="text/javascript"></script>
  </body>
</html>

You may run a little console.log() for ensure your import is fine, before working on script like this, if the log, at top of the js file doesn't not appear in your console browser, the script is probably not imported.


console.log("test");

let ps = document.querySelectorAll("p");
ps.forEach(function (p) {
  p.remove();
});

about 4 years ago · Juan Pablo Isaza Relatório

0

Correct your spelling. scr should be src.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda