-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhtmlForm.html
More file actions
28 lines (28 loc) · 967 Bytes
/
Copy pathhtmlForm.html
File metadata and controls
28 lines (28 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<html>
<body>
<form id='form'>
Email: <input type='text' name='email' value='newtonschool@gmail.com'>
Password: <input type='password' name='password' value='tendulkar'>
</form>
<!-- <form id='form2'>
firstName: <input type='text' name='firstName' value='sachin'>
lastName: <input type='text' name='lastName' value='tendulkar'>
</form> -->
<button onclick="getData()"> Login </button>
<script>
function getData () {
// console.log(document.forms)
// console.log(document.forms['form2'])
console.log(document.forms['form'])
console.log(document.forms['form'].attributes)
// console.log(data)
let data = document.forms['form']
for(var i=0; i<data.length; i++) {
// console.log(data[i])
// console.log(data.elements[i])
console.log(data.elements[i].name, data.elements[i].value)
}
}
</script>
</body>
</html>