Widget:SelectSearch: mudanças entre as edições

sem sumário de edição
Sem resumo de edição
Sem resumo de edição
Linha 28: Linha 28:
</div>
</div>


<script>
<script defer>
     const wrapper = document.querySelector(".selectwithSearch__container"),
     const wrapper = document.querySelector(".selectwithSearch__container"),
         selectBtn = wrapper.querySelector(".selectwithSearch__selectBtn"),
         selectBtn = wrapper.querySelector(".selectwithSearch__selectBtn"),
Linha 37: Linha 37:
         options.innerHTML = "";
         options.innerHTML = "";


         optionsValues.forEach(option => {
         optionsImage.forEach(option => {
             let isSelected = option.image === selectedOpt ? "selected" : "";
             let isSelected = option.image === selectedOpt ? "selected" : "";


Linha 62: Linha 62:
         let searchWord = searchInp.value.toLowerCase();
         let searchWord = searchInp.value.toLowerCase();


         arr = optionsValues.filter(data => {
         arr = optionsImage.filter(data => {
             return data.phrases.filter(curr => curr.toLowerCase().startsWith(searchWord)).length > 0;
             return data.phrases.filter(curr => curr.toLowerCase().startsWith(searchWord)).length > 0;
         }).map(option => {
         }).map(option => {