Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

95
Vistas
Why isn't the function action stays until refresh but suddenly vanishes after living the click

Here the function is working but the color on the <p> is does not stay for longer time as soon as i leave the button if comes to its original form

function color(){
   document.getElementById("change").style.color = "#ff00ff";
}

Html

<p id="change"></p>
<button onclick="color()">Change</button>
7 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

works perfectly at mine, but try this

document.getElementById('button_id').addEventListener('click', color)
7 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos