JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Interactive Button Example</title>
<style>
#myButton {
padding: 10px 20px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<button id="myButton">Click me!</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
var button = document.getElementById('myButton');
button.addEventListener('click', function() {
button.textContent = 'Button clicked!';
});
});
</script>
</body>
</html>
Code Output
JavaScript
JavaScript is a versatile programming language commonly used to create interactive and dynamic web content. With its wide range of functionalities and seamless integration with HTML and CSS, JavaScript allows developers to enhance the user experience and make web pages more engaging.