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

256
Vistas
How to use function from another JS file?

I am trying to use bubble.js function and have the function of bubble.js apply to my new js file called bubbleChanged.js file

bubble.js:

let bubble = document.getElementById("speach-bubble");
let noDisplay; bubble.style.display ="none";

const delay = setTimeout(bubbleAnimate,1500)

export function bubbleAnimate()
{
    noDisplay = bubble.style.display ="block";
    bubble.style.animation="slidein 1.6s 1";

}

bubbleChanged.js:

import{bubbleAnimate} from '../js/bubble.js';

let form = document.querySelector('.form')

form.addEventListener('submit' , (e) => {
    
    e.preventDefault();

  const input = document.getElementById('input').value;
  let textChange= document.getElementById('speach-bubble');

  textChange.innerHTML = "Welcome to your To-do app \n" + input;
  bubbleAnimate()
});

bubbleAnimate()
{
    textChnage.style.display ="block";
    textChnage.style.animation="slidein 1.6s 1";
}

not sure what I am doing wrong here? should the bubbleAnimate() be inside the event listener?

In short, when the speech bubble is updated after user input the same animation needs to happen when the speech bubble changes

about 4 years ago · Juan Pablo Isaza
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