0

How to hide the answer

In this given code i just want to hide the answer https://code.sololearn.com/WYguMSY39PKf/?ref=app

25th Jan 2021, 6:31 PM
Jitender Kumar
Jitender Kumar - avatar
5 Respostas
+ 1
.spoiler-wrap { display:none; }
25th Jan 2021, 6:35 PM
visph
visph - avatar
+ 1
visph hide inside the answer And when clicked on it ....it must be displayed
25th Jan 2021, 6:39 PM
Jitender Kumar
Jitender Kumar - avatar
+ 1
li:not(:hover) .spoiler-wrap { display:none; } show answer on mouse over list element with only css to hide/show on click you must use some js (or trickiest css hacks)
25th Jan 2021, 6:44 PM
visph
visph - avatar
+ 1
// js solution: onload = () => { var spoil = document.querySelectorAll('.spoiler-wrap'); spoil.forEach(e => { e.parentNode.onclick = _onclick.bind(e); e.style.display = 'none'; }); function _onclick() { this.style.display = this.style.display ? '' : 'none'; } };
25th Jan 2021, 6:57 PM
visph
visph - avatar
25th Jan 2021, 7:10 PM
visph
visph - avatar