티스토리 뷰

728x90

        const searchBox = document.querySelectorAll(".search span");    
        const cssList = document.querySelector(".list ul");       
        const cssCount = document.querySelector(".count em");    
        
        let listHTML = "";

        //목록 보여주기
        function updataList(list){
            listHTML = "";

            for(const data of list){
                listHTML += `
  • ${data.name} : ${data.desc} ${data.view}
  • `; } cssList.innerHTML = listHTML; } updataList(cssProperty); //버튼 클릭하기 searchBox.forEach(span => { span.addEventListener("click", () => { const target = span.dataset.view; const filterList = cssProperty.filter(data => data.view >= target) updataList(filterList); }); })
    320x100

    'Script Sample > SearchEffect' 카테고리의 다른 글

    SearchEffect06 - sort( ), reverse()  (0) 2022.02.21
    SearchEffect04 - find()  (0) 2022.02.21
    SearchEffect03 - charAt()  (0) 2022.02.21
    SearchEffect02 - includes()  (1) 2022.02.07
    SearchEffect01 - indexOf()  (7) 2022.02.07
    댓글
    © 2022 WonSeok, All rights reserved