0

Me preguntaba si hay alguna manera de que cuando escribo "en stock:" no solo se escriba, si no que realice una animación o algo que se vea agradable

function carro(id,id2,stock){
    let a=0;
    a=stock-document.getElementById(id).value
    document.getElementById(id2).innerHTML='En stock: ',a;
}

1 respuesta 1

1

Podrías crear una clase con css

.new { 
    background-color:yellow; 
} 

y en tu funcion agregar

function carro(id,id2,stock){
    let a=0;
    a=stock-document.getElementById(id).value
    let element=document.getElementById(id2);
    element.innerHTML='En stock: ',a;
    element.classList.add("new"); 
    setTimeout(function(){ element.classList.remove("new") }, 3000);
}

Es solo una idea.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.