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

260
Views
Delay popup loading after click

All I need it to do is delay the popup from "popping" for a few seconds after clicking a button. Is there anything wrong with this code?

$(document).ready(function() {
  $('#element-167 a').on("click", function() {
    $('.modal-dialog').delay(5000).fadeIn();
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You could use queue() and pass a function as parameter:

$(document).ready(function() {
  $('#element-167 a').on("click", function() {
    $(".modal-dialog").delay(5000).queue(() => {
      // Do things after 5 seconds
      $('.modal-dialog').fadeIn();
    })
  });
});
about 4 years ago · Juan Pablo Isaza Report

0

Try using setTimeout

$(document).ready(function() {
  $('#selected').on("click", function() {
      setTimeout(()=>{alert("Message here")},5000)
  });
});

<p id="selected">This is second paragraph.</p>
about 4 years ago · Juan Pablo Isaza Report
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!