How do you add innerHTML?



  • How to make innerHTML not clear the element, but add something

    document.getElementById('choise_area').innerHTML = '';
    


  • You can just use the previous meaning.

    <head>
    <script>
        function w() {
            var z = document.getElementById('z');
    
        z.innerHTML += 'three...';
    }
    

    </script>
    </head>
    <body onload="w();">
    <div id="z">One, two, </div>
    </body>

    Got it.

    One, two, three... ♪


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2