From 0fde14b04e35d88a0b48ee09dbf5d502531ab79e Mon Sep 17 00:00:00 2001 From: martinikf Date: Sat, 11 Mar 2023 14:29:07 +0100 Subject: [PATCH] Options for localization --- source/js/dselect.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/js/dselect.js b/source/js/dselect.js index 8b67424..fc69b67 100644 --- a/source/js/dselect.js +++ b/source/js/dselect.js @@ -99,11 +99,13 @@ function dselect(el, option = {}) { const creatable = attrBool('creatable') || option.creatable || defaultCreatable const clearable = attrBool('clearable') || option.clearable || defaultClearable const maxHeight = el.dataset.dselectMaxHeight || option.maxHeight || defaultMaxHeight + const placeholder = option.placeholder || "Search" + const noResults = option.noResults || "No results found" let size = el.dataset.dselectSize || option.size || defaultSize size = size !== '' ? ` form-select-${size}` : '' const classToggler = `form-select${size}` - const searchInput = search ? `` : '' + const searchInput = search ? `` : '' function attrBool(attr) { const attribute = `data-dselect-${attr}` @@ -199,7 +201,7 @@ function dselect(el, option = {}) {
${itemTags(el.querySelectorAll('*'))}
-
No results found
+
${noResults}
${clearBtn}