How to write text dynamically to HTML element (tag) using JavaScript

1 Answer

0 votes
<!DOCTYPE html> 
<html> 
<body> 
    <h1 id="h1_id">text to be replaced</h1>
    <script>
        var blabla = true;    
        if (blabla) document.getElementById('h1_id').innerHTML = "h1 & javascript";   
    </script>
</body> 
</html>

 



answered Oct 8, 2019 by avibootz

Related questions

...