先把瀏覽器原生驗證需要的欄位、送出控制項與非同步結果位置建立完整。
現在要做:先對照差異,再檢查 在 contact.html 的「contact-form fields and status」對照這項變更:<form id="contact-form">
<label for="name">姓名</label>
<input id="name" name="name" autocomplete="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="message">需求</label>
<textarea id="message" name="message" required></textarea>
<button id="submit-button" data-submit-control type="submit">送出</button>
<p id="status" role="status" aria-live="polite" data-state="idle">idle:尚未送出</p>
</form>
貼上位置:contact.html 的 contact-form fields and status 區塊
<form id="contact-form">
<label for="name">姓名</label>
<input id="name" name="name" autocomplete="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="message">需求</label>
<textarea id="message" name="message" required></textarea>
<button id="submit-button" data-submit-control type="submit">送出</button>
<p id="status" role="status" aria-live="polite" data-state="idle">idle:尚未送出</p>
</form>預期結果:contact.html 有一個表單、三個帶 label 的 required 欄位、submit button 與 #status;空白送出會先出現原生驗證提示。
驗收證據:Elements 的 form/label/input/textarea 巢狀關係、for 與 id 對照、#status 的 role 與空白送出驗證提示。
卡住時先看這裡
常見錯誤:只複製完整答案,卻沒有先理解這一項差異的責任。
第一個檢查:只對照目前差異指定的檔案與 anchor。