an example for innerHTML and getElementById

I need an example how can i use innerHTML and getElementbyId to store the data in to element.

Add Comment
  • 1 Answer(s)
      <!doctype html>
      <meta charset="utf-8">
      <title>Updating,Adding Content into Elements using Javascript</title>
      <style type="text/css">
      <script type="text/javascript">
      document.write("<p class='conc'>India</p>");
      function runmyjavaScript(){
      var cc = document.getElementById('cont');
      cc.innerHTML = "I love India";
      <body onLoad="runmyjavaScript()">
      <p id="cont"></p>
      Kid Answered on March 7, 2016.
      Add Comment

      Your Answer

      By posting your answer, you agree to the privacy policy and terms of service.