-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradio-button.js
More file actions
37 lines (30 loc) · 943 Bytes
/
radio-button.js
File metadata and controls
37 lines (30 loc) · 943 Bytes
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
const python = document.getElementById('python');
const java = document.getElementById('java');
const php = document.getElementById('php');
const javascript = document.getElementById('javascript');
const check = document.getElementById('check');
const button = document.getElementById('btn');
function disablebtn(){
if(check.checked){
button.disabled = false
button.style.background = 'blue';
}else {
button.disabled = true;
button.style.background = 'slategray';
}
}
disablebtn();
check.addEventListener('change', disablebtn);
button.addEventListener('click', function(){
if (python.checked){
alert('Loading the next question');
} else if (java.checked) {
alert('Loading the next question');
} else if (php.checked){
alert('Loading the next question');
}else if (javascript.checked){
alert('Loading the next question');
}else {
alert('The ansewr must be provided');
}
});