所以我目前正在嘗試訪問這個元素中的classNameHTML輸入:<div id="1"> <span> <input name="classNameHTML" type="text" /> <span></div>我目前寫的代碼是let cObj = document.getElementById(1);let cObjClass = cObj.children[0].classNameHTML.value; <--- buggy line錯誤信息:Uncaught TypeError: Cannot read property 'value' of undefinedat calcGrade (index.html:172)at HTMLButtonElement.onclick (index.html:243)我以為 children[0] 會引用 span,然后我可以通過它的輸入名稱使用 reference classNameHTML??刂婆_說 clasNameHTML 在我執行控制臺時未定義.log()。誰能告訴我,我在這里用點運算符做錯了什么?
子跨度內的 <輸入 /> 未定義
哈士奇WWW
2022-08-04 10:39:52