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

139
Views
Start function whenever there is someone clicking click, not only on refresh

I want that a new quote appears when the button is clicked. Right now the new quote comes whenever i refresh the page, but not when the button is clicked.

</head>
<body>
    <main> 
      <section class="container">
          <div id="advice-nr">ANOTHER QUOTE FOR YOU!</div>
          <div id="quote"></div>
          <hr>
          <button id="btn">  <img src="images/shuffle-arrows.png" height ="20" width="20">
          </button>
          
      </section>

    </main>
<script src="script.js"></script>
</body>
</html>
const quote = document.getElementById("quote");
const button = document.getElementById("btn");

button.addEventListener("click", getQuote());



function getQuote() {
    fetch("http://quotable.io/random")
    .then(res => res.json())
    .then(data => {
        quote.innerHTML = `"${data.content}"`;
      
    })
}
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!