<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>evantHandler</title>
<link rel="stylesheet" href="eventHandler.css">
<script src="eventHandler.js"></script>
</head>
<body>
<div id="wrapper">
<form name="formBox">
<input name="inputOne">
<input name="inputTwo">
<button name='btn'>BUTTON</button>
</form>
</div>
</body>
</html>
위 코드를 전제로,
window.onload=function(){
console.log(document.forms);
}
//[form, formBox: form] //HTMLCollection
window.onload=function(){
console.log(document.formBox);
}
//<form name="formBox">...</form> //HTMLFormElement
window.onload=function(){
for(let i of document.formBox){
console.log(i);
}
}
/*
<input name="inputOne">
<input name="inputTwo">
<button name="btn">BUTTON</button>
*/
'JavaScript' 카테고리의 다른 글
Map (0) | 2023.09.29 |
---|---|
Set (0) | 2023.09.28 |
배열 메서드 (0) | 2023.09.14 |
Map, set, get (0) | 2023.08.24 |
HTMLCollection, NodeList (0) | 2023.08.24 |