-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio.html
31 lines (27 loc) · 934 Bytes
/
radio.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
<!DOCTYPE html>
<input lang="en">
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Radio</title>
</head>
<body>
<h2>Mainpualte radio buttons using DOM</h2>
<input id="rd1" name="grp1" type="radio" value="Blockchain">Blockchain</input>
<input id="rd2" name="grp1" type="radio" value="Solidity">Solidity</input>
<button onclick="fn1()" id="btn1">Click Here</button>
<script>
function fn1(){
let rd1= document.getElementById("rd1");
let rd2=document.getElementById("rd2");
if(rd1.checked== true){
alert("the topic for today's class is "+ rd1.value);
}else{
alert("the topic for today's class is "+ rd2.value)
}
}
</script>
</body>
</html>