My form successfully sends an AJAX request upon submission. However, I have encountered an issue with the date field in the form. The change event listener works fine when the page initially loads, but it stops firing after the form is submitted once.
const date = document.querySelector('.latest-news__date');
if (date) {
date.addEventListener('change', function () {
// This event only triggers before the form is submitted.
});
}
I am seeking a solution to make this event still fire even after the form has been submitted. Any suggestions on how to achieve this?