Vanilla JS - click event

Size
1,832 Kb
Views
18,216

How do I make an vanilla js - click event?

What is a vanilla js - click event? How do you make a vanilla js - click event? This script and codes were developed by Tyler Lesperance on 24 November 2022, Thursday.

Vanilla JS - click event Previews

Vanilla JS - click event - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>vanilla JS - click event</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="the-box">The box</div> <script src="js/index.js"></script>
</body>
</html>

Vanilla JS - click event - Script Codes CSS Codes

body { background: #D2D2D2;
}
div { width: 35rem; height: 8rem; line-height: 4.5; background: #185901; display: block; text-align: center; font-size: 2rem; color: #FFF; text-decoration: none; text-transform: uppercase; padding: 0.25rem; margin: 2rem auto; cursor: pointer;
}

Vanilla JS - click event - Script Codes JS Codes

// When we click on the box let's use our friend
document.getElementById('the-box').addEventListener('click', function () { console.log("You finally clicked without jQuery");
});
// --> You finally clicked without jQuery
// ** This only happens when you click on it
Vanilla JS - click event - Script Codes
Vanilla JS - click event - Script Codes
Home Page Home
Developer Tyler Lesperance
Username tylerama
Uploaded November 24, 2022
Rating 3
Size 1,832 Kb
Views 18,216
Do you need developer help for Vanilla JS - click event?

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!

Tyler Lesperance (tylerama) Script Codes
Create amazing Facebook ads 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!