Changing Text and html Content Using Button in JavaScript
Here you will get the source code for Changing Text and html Content Using Button in JavaScript.Source Code
<!DOCTYPE html><html>
<head>
<meta charset ="utf-8">
<title>
change html content
</title>
<style>
.box{
background-color: #3A5795;
color: white;
height: 400px;
width:400px;
padding: 100px;
font-size: 20px
}
</style>
</head>
<body>
<div class="box" id="bluebox">
<p>
hello! how are you?
<button id="button1">Change html content</button>
</p>
<script>
document.getElementById("button1").onclick=function(){
document.getElementById("bluebox").innerHTML="<p>HelpMeOutAlways is a place for learning JavaScript<p>"
}
</script>
</div>
</body>
</html>
Output
Video Tutorial
Changing Text and html Content Using Button in JavaScript is very simple.
Enjoy learning JavaScript!
No comments: