Starter · code-edit

classList 與 dataset

先看見缺口,再完成一個小修改。

本階段驗收

頁面不會替你修改檔案;請在實作檔完成後重新整理確認。

目前要處理

card class 存在,is-selected 不存在。

預期看到

dataId=s2、before=false、after=true、其他 class 保留。

card.dataset.id;card.classList.toggle('is-selected')。

檔案清單

只在本階段資料夾內操作,避免改到其他章節。

證據:dataId=s2、selected=true、baseClass=true

前往 Checkpoint →