stackoverflow.com/questions/62365705/how-to-bind-text-input-to-another-div-on-the-same-html-page/

by kalovelo

HTML

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>

<!-- BRYTHON -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython.js" integrity="sha256-rA89wPrTJJQFWJaZveKW8jpdmC3t5F9rRkPyBjz8G04=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython_stdlib.js" integrity="sha256-Gnrw9tIjrsXcZSCh/wos5Jrpn0bNVNFJuNJI9d71TDs=" crossorigin="anonymous"></script>

</head>
<body onload="brython()">

  <div class="container">

    <h2 id="hello"></h2>
    <button id="alert-btn">Insert</button>

    <input type="text" id="text" placeholder="Enter something" oninput="outputUpdate();">
    <span id="output"></span>

</div>


<!-- Text bind -->

<script type="text/javascript" id="script2">

function outputUpdate(e){
let currentText=document.getElementById('text').value;

document.getElementById('output').innerHTML = currentText;
}
        
        
        
        
</script>

</body>
</html>