Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda