所以我目前正在嘗試訪問這個(gè)元素中的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錯(cuò)誤信息:Uncaught TypeError: Cannot read property 'value' of undefinedat calcGrade (index.html:172)at HTMLButtonElement.onclick (index.html:243)我以為 children[0] 會引用 span,然后我可以通過它的輸入名稱使用 reference classNameHTML??刂婆_說 clasNameHTML 在我執(zhí)行控制臺時(shí)未定義.log()。誰能告訴我,我在這里用點(diǎn)運(yùn)算符做錯(cuò)了什么?
子跨度內(nèi)的 <輸入 /> 未定義
哈士奇WWW
2022-08-04 10:39:52