JS Events - Change Style

Size
1,931 Kb
Views
50,600

How do I make an js events - change style?

What is a js events - change style? How do you make a js events - change style? This script and codes were developed by Colleen Van Lent on 26 August 2022, Friday.

JS Events - Change Style Previews

JS Events - Change Style - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>JS Events - Change Style</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>	<h1>Changing the Style</h1>	<p>JavaScript can change the style of an HTML element.</p>	<button type="button" onclick="openMe()">Open!</button>	<button type="button" onclick="closeMe()">Close!</button>	<p id="demo">Extra details...You can open and close this paragraph using the buttons above.</p> <script src="js/index.js"></script>
</body>
</html>

JS Events - Change Style - Script Codes CSS Codes

.closed{	display: none;
}
.open{	display: block;
}
button{	width:150px;	background-color: #00CCEE;	margin-left:15px;	font-size:120%;	}
#demo{	color:white;	background-color: #7F7F7F; padding:10px; font-size:120%
}

JS Events - Change Style - Script Codes JS Codes

function closeMe(){ // Find the element	x=document.getElementById("demo"); //Option 1: Change the style attribute directly	x.style.display="none"; //Option 2: Change the class // x.className="closed";	}
function openMe(){ // Find the element	x=document.getElementById("demo"); //Option 1: Change the style attribute directly x.style.display="block"; //Option 2: Change the class // x.className="open";	}
JS Events - Change Style - Script Codes
JS Events - Change Style - Script Codes
Home Page Home
Developer Colleen Van Lent
Username ColleenEMc
Uploaded August 26, 2022
Rating 3.5
Size 1,931 Kb
Views 50,600
Do you need developer help for JS Events - Change Style?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Colleen Van Lent (ColleenEMc) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!