dimanche 31 mai 2020

HTML: Automatically Display Given Input on the Same Page

my StackOverflow friends,

I would like to ask how should we write in HTML to display automatically an input given by the web user on the same page without a button or click.

Here is an example that I copy from elsewhere

> <!DOCTYPE HTML>
> <HTML>
> <head>
> </head> 
> <body>
> <script type="text/javascript">
>
> function changeThis(){      
>   var formInput = document.getElementById('theInput').value;   
>   document.getElementById('newText').innerHTML = formInput;   }  
> </script>
> 
> <p>You wrote: <span id='newText'></span> </p> 
> <input type='text' id='theInput'>   
> <input type='button' onclick='changeThis()' value='See what you wrote'/>   
> </body>  
> </html> 

I want to obtain the same effect without using any button, click or Enter tab.

In other words, the input given is display next to "You wrote" second after the user puts something on the line box.




Aucun commentaire:

Enregistrer un commentaire