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>
Try using setTimeout
$(document).ready(function() {
$('#selected').on("click", function() {
setTimeout(()=>{alert("Message here")},5000)
});
});
<p id="selected">This is second paragraph.</p>
Try to remove the "on" and just the element.click for instance:
$('#element-167 a').click (function() {})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.