-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange-button-text.html
More file actions
48 lines (45 loc) · 1.59 KB
/
change-button-text.html
File metadata and controls
48 lines (45 loc) · 1.59 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
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<title>버튼 텍스트 변경 접근성 적용하기</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://a11y-nvisions.github.io/js/announceForAccessibility.js"></script>
<script>
$(document).ready(function() {
var btn = $("#button");
var btn2 = $("#button2");
btn.on('click',function() {
if (btn.text() == "사용하기") {
btn.text("취소하기");
} else {
btn.text("사용하기");
}
});
btn2.on('click',function() {
if (btn2.text() == "사용하기") {
btn2.text("취소하기");
btn2.attr("aria-label","취소");
} else {
btn2.text("사용하기");
btn2.attr("aria-label","사용");
};
});
});
</script>
</head>
<body>
<main>
<div class="bad">
<h2>접근성 미적용</h2>
<button id="button">사용하기</button>
</div>
<div class="good">
<h2>접근성 적용 버전</h2>
<button screen-reader-live id="button2" aria-label="사용">사용하기</button>
</div>
</main>
</body>
</html>