There is a form in the popup window that sends data to Ajax. After a successful form, a message about successful submission with the .form-message--success
class appears below. I would like that when this class appears in 5 seconds, the window close button with the id #close_pop a
is clicked.
Is this possible when a class is added dynamically to the DOM?
I tried something like this, but it doesn't work(
jQuery(document).ready(function($) {
$('.jet-form-message--success').on(function(){
setTimeout(function(){
$('#close_pop a').click();
}, 2000);
});
});