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

168
Views
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 answers
Answer question

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 Report

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 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!