I have a form with steps created with GravitForms/WordPress.
I created a function to copy dropdown value to an input value and a div from the first page to the second page.
At the first time, it works fine, but if if go back from page 2 to page 1 et change the select value, the input value doesn’t update.
Is there any way to force triggering onChange of select dropdown ?
My code :
var select_dates = document.getElementById("input_4_3");
select_dates.addEventListener("change", function() {
document.getElementById("date_left").innerHTML = select_dates.value;
document.getElementById("input_4_33").value = select_dates.value;
console.log(select_dates.value);
});
2
Answers
You tagged jQuery so here is a jQuery answer
Change the dropdown and then click the link
You possibly load the selects using AJAX so try this delegation
ctrl-left arrow to come back
You can trigger change event on select element using this: