-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPoll.html
669 lines (599 loc) · 26.4 KB
/
Poll.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
<html>
<head>
<script type="text/javascript">
var buttons1, buttons2, buttons3, buttons4, buttons5, buttons6, buttons7, buttons8, buttons9, buttons10;
function pageLoaded()
{
buttons1 = document.querySelectorAll(".choice1 button");
tally1 = {
1: 5,
2: 8,
3: 6,
total: 19
};
buttons2 = document.querySelectorAll(".choice2 button");
tally2 = {
1: 7,
2: 5,
3: 7,
total: 19
};
buttons3 = document.querySelectorAll(".choice3 button");
tally3 = {
1: 6,
2: 6,
3: 7,
total: 19
};
buttons4 = document.querySelectorAll(".choice4 button");
tally4 = {
1: 5,
2: 8,
3: 6,
total: 19
};
buttons5 = document.querySelectorAll(".choice5 button");
tally5 = {
1: 3,
2: 9,
3: 7,
total: 19
};
buttons6 = document.querySelectorAll(".choice6 button");
tally6 = {
1: 9,
2: 4,
3: 6,
total: 19
};
buttons7 = document.querySelectorAll(".choice7 button");
tally7 = {
1: 8,
2: 7,
3: 4,
total: 19
};
buttons8 = document.querySelectorAll(".choice8 button");
tally8 = {
1: 7,
2: 5,
3: 7,
total: 19
};
buttons9 = document.querySelectorAll(".choice9 button");
tally9 = {
1: 9,
2: 5,
3: 5,
total: 19
};
buttons10 = document.querySelectorAll(".choice10 button");
tally10 = {
1: 5,
2: 6,
3: 8,
total: 19
};
//alert("calling setup");
setup();
}
function vote1(choice) {
tally1[choice]++;
tally1["total"]++;
buttons1[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons1.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons1[i].style.cursor = "not-allowed";
buttons1[i].disabled = "true";
}
var spans1 = document.querySelectorAll(".percentage1");
var bars1 = document.getElementsByClassName("bar1");
for(var i=0; i<spans1.length; i++)
{
var percentage1 = barPercentage(bars1[i], tally1);
spans1[i].innerHTML = percentage1.toString() + "%";
}
//alert(tally);
}
function vote2(choice) {
tally2[choice]++;
tally2["total"]++;
buttons2[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons2.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons2[i].style.cursor = "not-allowed";
buttons2[i].disabled = "true";
}
var spans2 = document.querySelectorAll(".percentage2");
var bars2 = document.getElementsByClassName("bar2");
for(var i=0; i<spans2.length; i++)
{
var percentage2 = barPercentage(bars2[i], tally2);
spans2[i].innerHTML = percentage2.toString() + "%";
}
//alert(tally);
}
function vote3(choice) {
tally3[choice]++;
tally3["total"]++;
buttons3[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons3.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons3[i].style.cursor = "not-allowed";
buttons3[i].disabled = "true";
}
var spans3 = document.querySelectorAll(".percentage3");
var bars3 = document.getElementsByClassName("bar3");
for(var i=0; i<spans3.length; i++)
{
var percentage3 = barPercentage(bars3[i], tally3);
spans3[i].innerHTML = percentage3.toString() + "%";
}
//alert(tally);
}
function vote4(choice) {
tally4[choice]++;
tally4["total"]++;
buttons4[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons4.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons4[i].style.cursor = "not-allowed";
buttons4[i].disabled = "true";
}
var spans4 = document.querySelectorAll(".percentage4");
var bars4 = document.getElementsByClassName("bar4");
for(var i=0; i<spans4.length; i++)
{
var percentage4 = barPercentage(bars4[i], tally4);
spans4[i].innerHTML = percentage4.toString() + "%";
}
//alert(tally);
}
function vote5(choice) {
tally5[choice]++;
tally5["total"]++;
buttons5[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons5.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons5[i].style.cursor = "not-allowed";
buttons5[i].disabled = "true";
}
var spans5 = document.querySelectorAll(".percentage5");
var bars5 = document.getElementsByClassName("bar5");
for(var i=0; i<spans5.length; i++)
{
var percentage5 = barPercentage(bars5[i], tally5);
spans5[i].innerHTML = percentage5.toString() + "%";
}
//alert(tally);
}
function vote6(choice) {
tally6[choice]++;
tally6["total"]++;
buttons6[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons6.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons6[i].style.cursor = "not-allowed";
buttons6[i].disabled = "true";
}
var spans6 = document.querySelectorAll(".percentage6");
var bars6 = document.getElementsByClassName("bar6");
for(var i=0; i<spans6.length; i++)
{
var percentage6 = barPercentage(bars6[i], tally6);
spans6[i].innerHTML = percentage6.toString() + "%";
}
//alert(tally);
}
function vote7(choice) {
tally7[choice]++;
tally7["total"]++;
buttons7[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons7.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons7[i].style.cursor = "not-allowed";
buttons7[i].disabled = "true";
}
var spans7 = document.querySelectorAll(".percentage7");
var bars7 = document.getElementsByClassName("bar7");
for(var i=0; i<spans7.length; i++)
{
var percentage7 = barPercentage(bars7[i], tally7);
spans7[i].innerHTML = percentage7.toString() + "%";
}
//alert(tally);
}
function vote8(choice) {
tally8[choice]++;
tally8["total"]++;
buttons8[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons8.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons8[i].style.cursor = "not-allowed";
buttons8[i].disabled = "true";
}
var spans8 = document.querySelectorAll(".percentage8");
var bars8 = document.getElementsByClassName("bar8");
for(var i=0; i<spans8.length; i++)
{
var percentage8 = barPercentage(bars8[i], tally8);
spans8[i].innerHTML = percentage8.toString() + "%";
}
//alert(tally);
}
function vote9(choice) {
tally9[choice]++;
tally9["total"]++;
buttons9[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons9.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons9[i].style.cursor = "not-allowed";
buttons9[i].disabled = "true";
}
var spans9 = document.querySelectorAll(".percentage9");
var bars9 = document.getElementsByClassName("bar9");
for(var i=0; i<spans9.length; i++)
{
var percentage9 = barPercentage(bars9[i], tally9);
spans9[i].innerHTML = percentage9.toString() + "%";
}
//alert(tally);
}
function vote10(choice) {
tally10[choice]++;
tally10["total"]++;
buttons10[choice-1].style.backgroundImage = "linear-gradient(to right, #f5b0ee , white)";
for (var i = 0; i < buttons10.length; i++) {
//buttons[i].style.opacity = 0.65;
buttons10[i].style.cursor = "not-allowed";
buttons10[i].disabled = "true";
}
var spans10 = document.querySelectorAll(".percentage10");
var bars10 = document.getElementsByClassName("bar10");
for(var i=0; i<spans10.length; i++)
{
var percentage10 = barPercentage(bars10[i], tally10);
spans10[i].innerHTML = percentage10.toString() + "%";
}
//alert(tally);
}
function barPercentage(node, tally) {
var choice = node.dataset.choice;
if (tally[choice])
return tally[choice]/tally["total"] * 100;
return 0;
}
function renderBars() {
//alert("inside renderbars");
var bars1 = document.getElementsByClassName("bar1");
for (var i = 0; i < bars1.length; i++) {
var percentage1 = barPercentage(bars1[i], tally1);
console.log(percentage1);
bars1[i].style.width = percentage1.toString() + "%";
}
var bars2 = document.getElementsByClassName("bar2");
for (var i = 0; i < bars2.length; i++) {
var percentage2 = barPercentage(bars2[i], tally2);
console.log(percentage2);
bars2[i].style.width = percentage2.toString() + "%";
}
var bars3 = document.getElementsByClassName("bar3");
for (var i = 0; i < bars3.length; i++) {
var percentage3 = barPercentage(bars3[i], tally3);
console.log(percentage2);
bars3[i].style.width = percentage3.toString() + "%";
}
var bars4 = document.getElementsByClassName("bar4");
for (var i = 0; i < bars4.length; i++) {
var percentage4 = barPercentage(bars4[i], tally4);
console.log(percentage2);
bars4[i].style.width = percentage4.toString() + "%";
}
var bars5 = document.getElementsByClassName("bar5");
for (var i = 0; i < bars5.length; i++) {
var percentage5 = barPercentage(bars5[i], tally5);
console.log(percentage2);
bars5[i].style.width = percentage5.toString() + "%";
}
var bars6 = document.getElementsByClassName("bar6");
for (var i = 0; i < bars6.length; i++) {
var percentage6 = barPercentage(bars6[i], tally6);
console.log(percentage2);
bars6[i].style.width = percentage6.toString() + "%";
}
var bars7 = document.getElementsByClassName("bar7");
for (var i = 0; i < bars7.length; i++) {
var percentage7 = barPercentage(bars7[i], tally7);
console.log(percentage2);
bars7[i].style.width = percentage7.toString() + "%";
}
var bars8 = document.getElementsByClassName("bar8");
for (var i = 0; i < bars8.length; i++) {
var percentage8 = barPercentage(bars8[i], tally8);
console.log(percentage2);
bars8[i].style.width = percentage8.toString() + "%";
}
var bars9 = document.getElementsByClassName("bar9");
for (var i = 0; i < bars9.length; i++) {
var percentage9 = barPercentage(bars9[i], tally9);
console.log(percentage2);
bars9[i].style.width = percentage9.toString() + "%";
}
var bars10 = document.getElementsByClassName("bar10");
for (var i = 0; i < bars10.length; i++) {
var percentage10 = barPercentage(bars10[i], tally10);
console.log(percentage2);
bars10[i].style.width = percentage10.toString() + "%";
}
}
function setup() {
// Set up event listeners
//alert("inside setup");
//alert(buttons.length);
for (var i = 0; i < buttons1.length; i++) {
buttons1[i].addEventListener("click", function(e) {
vote1(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons2.length; i++) {
buttons2[i].addEventListener("click", function(e) {
vote2(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons3.length; i++) {
buttons3[i].addEventListener("click", function(e) {
vote3(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons4.length; i++) {
buttons4[i].addEventListener("click", function(e) {
vote4(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons5.length; i++) {
buttons5[i].addEventListener("click", function(e) {
vote5(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons6.length; i++) {
buttons6[i].addEventListener("click", function(e) {
vote6(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons7.length; i++) {
buttons7[i].addEventListener("click", function(e) {
vote7(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons8.length; i++) {
buttons8[i].addEventListener("click", function(e) {
vote8(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons9.length; i++) {
buttons9[i].addEventListener("click", function(e) {
vote9(e.target.dataset["choice"]);
renderBars();
});
}
for (var i = 0; i < buttons10.length; i++) {
buttons10[i].addEventListener("click", function(e) {
vote10(e.target.dataset["choice"]);
renderBars();
});
}
renderBars();
}
</script>
<style type = "text/css">
.choice {
display: inline;
width: 50%;
align:left;
}
.result {
display: flex;
flex-direction: column;
justify-content: left;
height:90px;
align:left;
}
.bar .bar1 .bar2 .bar3 .bar4 .bar5 .bar6 .bar7 .bar8 .bar9 .bar10{
height: 100%;
width: 20%;
/* margin: 0 auto; */
align:left;
font: bold 15px Georgia, serif;
color:black;
/*background-image: linear-gradient(to right, #b0d9f5 , white);*/
}
.collapsible {
background-color: white;
color: black;
cursor: pointer;
padding: 18px;
width: 100%;
border: 1px solid black;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: palevioletred;
}
.content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;
width:100%;
}
.bar1[data-choice="1"], .bar2[data-choice="1"], .bar3[data-choice="1"], .bar4[data-choice="1"], .bar5[data-choice="1"], .bar6[data-choice="1"], .bar7[data-choice="1"], .bar8[data-choice="1"], .bar9[data-choice="1"], .bar10[data-choice="1"]{
background-image: linear-gradient(to right, #b0d9f5 , white);
}
.bar1[data-choice="2"], .bar2[data-choice="2"], .bar3[data-choice="2"], .bar4[data-choice="2"], .bar7[data-choice="2"], .bar5[data-choice="2"], .bar6[data-choice="2"], .bar8[data-choice="2"], .bar9[data-choice="2"], .bar10[data-choice="2"]{
background-image: linear-gradient(to right, #b0d9f5 , white);
}
.bar1[data-choice="3"], .bar2[data-choice="3"], .bar3[data-choice="3"], .bar4[data-choice="3"], .bar5[data-choice="3"], .bar6[data-choice="3"], .bar7[data-choice="3"], .bar8[data-choice="3"], .bar9[data-choice="3"], .bar10[data-choice="3"]{
background-image: linear-gradient(to right, #b0d9f5 , white);
}
.percentage .percentage1 .percentage2 .percentage10 .percentage9 .percentage8 .percentage7 .percentage6 .percentage5 .percentage4 {
display: inline;
align:justify;
}
/*@media (max-width: 800px) {
.flex-container {
flex-direction: row;
}*/
}
</style>
</head>
<body onload="pageLoaded()" style="align:left;">
<h1 align="center">Ongoing Polls</h1>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Is India handling Covid-19 well?</h3>
</button>
<div class="content">
<div class="choice1 choice" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar1" data-choice="1">Yes</button><label class="percentage1"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar1" data-choice="2">No</button><label class="percentage1"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar1" data-choice="3">Can't say</button><label class="percentage1"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Is the current rate of vaccination in India good enough?</h3>
</button>
<div class="content">
<div class="choice2" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar2" data-choice="1">Yes</button><label class="percentage2"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar2" data-choice="2">No</button><label class="percentage2"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar2" data-choice="3">Can't say</button><label class="percentage2"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Should there be a second thought on Virat's captaincy after the defeat in WTC Final?</h3>
</button>
<div class="content">
<div class="choice3" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar3" data-choice="1">Yes</button><label class="percentage3"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar3" data-choice="2">No</button><label class="percentage3"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar3" data-choice="3">Can't say</button><label class="percentage3"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Will the opposition be united after Sharad Pawar's initiative?</h3>
</button>
<div class="content">
<div class="choice4" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar4" data-choice="1">Yes</button><label class="percentage4"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar4" data-choice="2">No</button><label class="percentage4"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar4" data-choice="3">Can't say</button><label class="percentage4"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Should the way for assembly elections be cleared in Jammu and Kashmir?
</h3>
</button>
<div class="content">
<div class="choice5" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar5" data-choice="1">Yes</button><label class="percentage5"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar5" data-choice="2">No</button><label class="percentage5"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar5" data-choice="3">Can't say</button><label class="percentage5"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Should those with more than 2 children be denied government schemes?</h3>
</button>
<div class="content">
<div class="choice6" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar6" data-choice="1">Yes</button><label class="percentage6"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar6" data-choice="2">No</button><label class="percentage6"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar6" data-choice="3">Can't say</button><label class="percentage6"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Did the parliamentary committee rightly reprimand Twitter?</h3>
</button>
<div class="content">
<div class="choice7" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar7" data-choice="1">Yes</button><label class="percentage7"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar7" data-choice="2">No</button><label class="percentage7"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar7" data-choice="3">Can't say</button><label class="percentage7"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Are Baba Ramdev's objections on the attitude of the IMA correct?</h3>
</button>
<div class="content">
<div class="choice8" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar8" data-choice="1">Yes</button><label class="percentage8"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar8" data-choice="2">No</button><label class="percentage8"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar8" data-choice="3">Can't say</button><label class="percentage8"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Is the anti-agriculture law movement becoming infamous?</h3>
</button>
<div class="content">
<div class="choice9" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar9" data-choice="1">Yes</button><label class="percentage9"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar9" data-choice="2">No</button><label class="percentage9"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar9" data-choice="3">Can't say</button><label class="percentage9"></label></div><br/>
</div>
</div>
</div>
<button type="button" class="collapsible" title="Click to cast your vote">
<h3>Has the central government failed to act against the political violence in Bengal?</h3>
</button>
<div class="content">
<div class="choice10" style="width=25%;">
<div class="result">
<div style="border:1px solid black; width:20%;"><button class="bar10" data-choice="1">Yes</button><label class="percentage10"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar10" data-choice="2">No</button><label class="percentage10"></label></div><br/>
<div style="border:1px solid black; width:20%;"><button class="bar10" data-choice="3">Can't say</button><label class="percentage10"></label></div><br/>
</div>
</div>
</div>
<script>
var coll = document.getElementsByClassName("collapsible");
var count;
for (count = 0; count < coll.length; count++) {
coll[count].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
}
else {
content.style.display = "block";
}
});
}
</script>
</body>
</html>