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

132
Views
Is there a way to directly style text content generated in JavaScript?

I'm building a tic-tac-toe game, and built the squares of the gameboard with p HTML elements. Whenever a square is clicked on, I'm running a function that takes a variable of turn, which is equal to 'X', and inserts it into the square when the square is clicked on. The function also toggles the variable's text, so 'O' is next.

Is there a way to directly style these 'X's and 'O's? I've tried to style the p elements color and font-size, and this worked, but now I'm trying to style the position of the 'X's and 'O's within the square.

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

0

You can add the classes to your CSS file and then add them to the corresponding elements.

An example:

let elementX = document.getElementById("element_x");

elementX.classList.add("element_x_class");
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!