Changing Text and html Content Using Button in JavaScript (With video tutorial) - HelpMeOutAlways

Saturday, December 7, 2019

Changing Text and html Content Using Button in JavaScript (With video tutorial)

 

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

javaScript in helpmeoutalways





                                         




           
javaScript in helpmeoutalways




 Video Tutorial

Changing Text and html Content Using Button in JavaScript is very simple.
Enjoy learning JavaScript!

No comments:

@way2themes