-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradio-button.html
More file actions
81 lines (77 loc) · 2.1 KB
/
radio-button.html
File metadata and controls
81 lines (77 loc) · 2.1 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
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>라디오 버튼 접근성 이슈</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
.radio-btn{
width:auto;
height:30px;
}
.radio-btn p{
float:left;
margin:0 10px 0 0;
}
</style>
<script>
$(function(){
$('.info').on('click',function(){
alert('현재 세일기간이 아닙니다.')
});
$('.info2, .btn').mouseup(function(){
if((event.button == 1)||(event.which == 1)){
$(this).prop('checked',true);
$(this).attr("aria-checked","true");
alert('현제 세일기간이 아닙니다.')
}else{
return false;
}
});
$('.info2').on('keydown', function(e){
var code = e.keyCode
if(code == 32){
$(this).prop('checked',true);
$(this).attr("aria-checked","true");
alert('현제 세일기간이 아닙니다.')
}else{
$('.info2').prop('checked',false);}
});
});
</script>
</head>
<body>
<h1>radio버튼</h1>
<p></p>
<div class="bad">
<h2>접근성 미적용 예시</h2>
<div class="radio-btn" role="group" aria-label="메뉴 선택">
<p><input type="radio" name="r-btn" id="mac" class="info">
<label for="mac">맥도날드</label>
</p>
<p><input type="radio" name="r-btn" id="lot" class="info">
<label for="lot">롯데리아</label>
</p>
<p><input type="radio" name="r-btn" id="kfc" class="info">
<label for="kfc">KFC</label>
</p>
</div>
</div>
<p></p>
<div class="good">
<h2>접근성 적용 예시</h2>
<div class="radio-btn">
<p><input type="radio" name="r-btn2" id="mac2" class="info2" aria-checked="false">
<label for="mac2" class="btn">맥도날드</label>
</p>
<p><input type="radio" name="r-btn2" id="lot2" class="info2" aria-checked="false">
<label for="lot2" class="btn">롯데리아</label>
</p>
<p><input type="radio" name="r-btn2" id="kfc2" class="info2" aria-checked="false">
<label for="kfc2" class="btn">KFC</label>
</p>
</div>
</div>
</body>
</html>