Files
front-end-example/04-dom-events-async/01-query-selectors/starter.js
2026-03-23 14:56:04 +08:00

14 lines
422 B
JavaScript

// 任务:
// 1. 用 getElementById 获取标题
// 2. 用 querySelector 获取按钮
// 3. 用 querySelectorAll 获取全部卡片
// 4. 在控制台输出标题文字、按钮文字和卡片数量
const a = document.getElementById("page-title")
console.log(a.textContent);
const b = document.querySelector(".start-btn")
console.log(b.textContent);
const c = document.querySelectorAll(".card")
console.log(c.length);