Hi,
I'm using Metronic 8.1.4 and I noticed a bug regarding select2 (inside a form).
When I reset the form (by clicking on input type="reset") the form itself reverts back to its default values but select2 keep showing previuous values (seems more a visual inconsistency).
You can reproduce yourself by pointing to https://preview.keenthemes.com/metronic8/demo1/index.html and then:
- open quick search on dashboard
- open advanced options menu
- change some value (including select)
- click Cancel button
Hi,
This is expected behavior as Select2 does not list the form reset event.
You should use the below workaround to reset select2 and use it in the form reset event:
const form = document.getElementById("formid");
form.addEventListener("reset", function() {
$("#select2id").val("").trigger("change");
});
I swear I never noticed -_-'
Thank you.
You are welcome. If you need any further help please let us know