-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
83 lines (71 loc) · 2.92 KB
/
index.html
File metadata and controls
83 lines (71 loc) · 2.92 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div>이름 : <input type="text" id="name" value="" /></div>
<div>지역 :
<select id="city" onchange="changeCity();"></select>
<div>동네 :
<select id="region_02">
<option value="">강남</option>
<option value="">서초</option>
</select>
<select id="region_064" style="display: none;">
<option value="">제주시</option>
<option value="">서귀포시</option>
</select>
</div>
</div>
<div>
테스트 : <input type="test" id="test" value="" />
</div>
<button type="button" onclick="regist();">등록</button>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script>
function regist() {
alert(document.getElementById("name").value);
alert($("#name").val()) //JQuery 이용 코드 단순화 위랑 같은 코드
}
function changeCity() {
//let city = document.getElementById("city").value;
//document.getElementById("region_02").style.display = "none";
//document.getElementById("region_064").style.display = "none";
//document.getElementById("region_"+city).style.display = "";
let city = $('#city').val();
$("#region_02").hide();
$("#region_064").hide();
$("#region_"+city).show();
}
function loadcity(){
let city = [{
code: "02",
name: "서울"
},
{
code:"064",
name: "제주"
}
];
for (let i = 0; i<city.length; i++){
if (i==0) $('#city').append('<option value="' + city[i].code + '" selected>' + city[i].name + '</option>');
else $('#city').append('<option value="' + city[i].code + '">' + city[i].name + '</option>');
}
}
loadcity();
var x = 1;
x = x + 2;
document.getElementById("test").value = x;
var x = 2;
document.getElementById("test").value = x;
</script>
</body>
</html>