forked from rhl-foundation/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandard.html
49 lines (47 loc) · 1.17 KB
/
standard.html
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
<!DOCTYPE html>
<html>
<head>
<title>Radio Button Section Switching</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
.section {
display: none;
}
.section.active {
display: block;
}
</style>
<script>
$(document).ready(function() {
$('input[type="radio"]').change(function() {
var sectionId = $(this).val();
$('.section').removeClass('active');
$('#' + sectionId).addClass('active');
});
});
</script>
</head>
<body>
<label>
<input type="radio" name="section" value="section1"> Section 1
</label>
<br>
<label>
<input type="radio" name="section" value="section2"> Section 2
</label>
<br>
<label>
<input type="radio" name="section" value="section3"> Section 3
</label>
<br>
<div id="section1" class="section">
Content of Section 1
</div>
<div id="section2" class="section">
Content of Section 2
</div>
<div id="section3" class="section">
Content of Section 3
</div>
</body>
</html>