Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

252
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda