Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!