Creating JavaScript toggle button

In this video I will show how simple is to make JavaScript toggle button to hide or show an element on HTML document.

Here is the source codes:

<!DOCTYPE html>
		<title>Toggle Button</title>
		<button onclick="toggle()">Toggle</button>
		<p id="test">Sample Text</p>
			var toggled = false;
			function toggle(){
					toggled = true;
					document.getElementById("test").style.display = "none";
					toggled = false;
					document.getElementById("test").style.display = "block";

Here is the live demo of the script:

Sample Text

Or, you can use jQuery to make this toggle thing much easier. Read this tutorial.

Getting boored? Why not playing a game?

Power Block

Tiki Solitaire

Pet Connect

Cake Shop

Jewels Blitz 3

Forest Match

Bike Racing


Solitaire Swift

Bubble Shooter Classic HD

Black and white snake