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

174
Visualizações
Changing paragraph tag color by console

I want to get all the paragraph tags on a page to be white by putting something into the console. I tried something like this:

document.p.style.color = 'white';

but that did not work. I know changing the body tag works in the console tho

document.body.style.background = 'black';
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Here is an example code for your answer:

HTML:

<p id="ANYTHING_YOU_WANT">ANYTHING_YOU_WANT</p>

JS:

const VARIABLE_NAME = document.getElementById("ANYTHING_YOU_WANT");

VARIABLE_NAME.style.color = "aqua";

Give your class and text instead of ANYTHING_YOU_WANT and your variable name instead of VARIABLE_NAME...

about 4 years ago · Juan Pablo Isaza Relatório

0

You would need to select paragraph individually or select them in bulk to change their properties.

Since there is only 1 body document.body works

But there can be multiple paragraphs so

You either need to select them by thier id `**

document.getElementById("Id")

**` or you could do **

document.querySelectorAll('p').forEach(p => p.style.color = 'white');**

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