[ad_1]
Let me explain this best. I have a generated form with an event listener, so changing an option from a dropdown will cause a change at the bottom of the page based on the selection.
If you inspect the dropdown, you’ll see that it has a “bubbling” event associated with it. All dropdowns in the form will display:
function(e) {
e.preventDefault(), e.stopImmediatePropagation();
let a = new Array;
const o = _.closest(".thpb_combo_p_grid_pvariants");
o.querySelectorAll(".thpb_combo_p_grid_variant_select").forEach(function
a.push(t.options[t.selectedIndex].value)
}), t(o, a)
}
I’m using a CSS div instead using the jquery Pretty Dropdowns script. The dropdown is successfully created and everything looks fine, but now the event is not firing while I am selecting an option in the new dropdown.
I don’t know if there is a way to fire an event on the hidden select box whenever there is a change.
If that makes sense…
Thanks for all the feedback.
Here is another code from a 3rd party script. My code should trigger a “change” on the thpb_combo_p_grid_variant_select class, but I have not seen this event fired by the change.
document.querySelector(".thpb_combo_p_grid_variant_select") && document.querySelectorAll(".thpb_combo_p_grid_variant_select").forEach(function(_) {
_[s]("change", function(e) {
e.preventDefault(), e.stopImmediatePropagation();
let a = new Array;
const o = _.closest(".thpb_combo_p_grid_pvariants");
o.querySelectorAll(".thpb_combo_p_grid_variant_select").forEach(function
a.push(t.options[t.selectedIndex].value)
}), t(o, a)
}), _.dispatchEvent(new Event("change"))
})
[ad_2]
Source link