Select2: add option to close when clearing selection (#3870)

This commit is contained in:
Richard Schreiber
2024-02-13 22:27:36 +01:00
committed by GitHub
parent d5f9beef69
commit 7b5ce5e198

View File

@@ -613,6 +613,13 @@ var form_handlers = function (el) {
}, 50);
}
});
if ($s[0].hasAttribute("data-close-on-clear")) {
$s.on("select2:clear", function () {
window.setTimeout(function () {
$s.select2('close');
}, 50);
});
}
});
el.find('[data-model-select2=event]').each(function () {