Skip to content

Commit b0feb8b

Browse files
authored
Create userInput_prompt.html
1 parent 65340a5 commit b0feb8b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<script>
8+
9+
function add_data() {
10+
size = prompt("Enter Food Size .... ");
11+
data = []
12+
13+
for (let index = 0; index < size; index++) {
14+
15+
data.push(prompt("Enter Food Name .... "));
16+
17+
}
18+
19+
p_data = document.getElementById("print_data");
20+
21+
for (let index = 0; index < data.length; index++) {
22+
23+
// print all elements
24+
p_data.innerHTML += "<li>" + data[index] + "</li>";
25+
26+
}
27+
28+
29+
30+
}
31+
</script>
32+
</head>
33+
<body>
34+
35+
<button onclick="add_data()">Add Record</button>
36+
37+
<ul id="print_data">
38+
39+
</ul>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)