From 5e18799e3b342d787cfab7cddad05a358f784154 Mon Sep 17 00:00:00 2001 From: garammasala29 Date: Fri, 25 Mar 2022 00:00:21 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BB=E3=83=AC=E3=82=AF=E3=83=88=E3=83=9C?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=82=B9=E3=81=AEID=E3=81=8C=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E3=81=99=E3=82=8C=E3=81=B0new=20Choices=E3=81=99?= =?UTF-8?q?=E3=82=8B=E5=BD=A2=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit コンソールにエラーが表示されてしまうため --- app/javascript/company-select.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/javascript/company-select.js b/app/javascript/company-select.js index e7acaf9582c..090bb57b84c 100644 --- a/app/javascript/company-select.js +++ b/app/javascript/company-select.js @@ -1,11 +1,15 @@ import Choices from 'choices.js' document.addEventListener('DOMContentLoaded', () => { - return new Choices('#js-company-select', { - removeItemButton: true, - searchResultLimit: 10, - searchPlaceholderValue: '検索ワード', - noResultsText: '一致する情報は見つかりません', - itemSelectText: '選択' - }) + const element = document.getElementById('js-company-select') + if (element) { + return new Choices(element, { + removeItemButton: true, + allowHTML: true, + searchResultLimit: 10, + searchPlaceholderValue: '検索ワード', + noResultsText: '一致する情報は見つかりません', + itemSelectText: '選択' + }) + } })