在 jQuery 中,attr 取得的是 HTML 初始屬性,prop 取得的是目前 DOM 狀態。因此核取方塊是否勾選,應優先使用 prop。
結論:處理 checked、selected、disabled 等動態狀態時,應使用 prop。