How to make edit text without clicking?

Greetings to all!
How to make so when you enter text in the text field, it automatically changed without datagate button
<script type="text/javascript">
changeText2 function(){
 var userInput = document.getElementById('userInput').value;
 document.getElementById('boldStuff2').innerHTML = userInput;
}
</script>
<p>
Change the text entered in the form <b id='boldStuff2'>namely</b> </p>
<input type='text' id='userInput' value=' Enter your phrase ' /><input type='button' onclick='changeText2()' value='Change Text'/>
March 19th 20 at 08:45
1 answer
March 19th 20 at 08:47
Solution
Rock the handler for onchange, not onclick, comrade.

Find more questions by tags HTML