html
html
1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<head>
<title>Show/Hide button</title>
</head>
<body>
<button onclick="showhide()" id="b">Hide</button>
<p id="e">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
s=true;
function showhide(){
if (s){
hide();
s=!s;
}
else {
show();
s=!s;
}
}
function show(){
document.getElementById("e").style.display = "block";
document.getElementById("b").innerHTML = "Hide";
}
function hide(){
document.getElementById("e").style.display = "none";
document.getElementById("b").innerHTML = "Show";
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run