w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to input user data through a text field, then display immediately below the text field?

This is without jQuery.

Add an id to your button and create the empty text area with id 'textDiv' and try this.

<script type="text/javascript">

         var button = document.getElementById('button_ID');
         button.addEventListener('click',showText);

         function showText() {
             document.getElementById('textDiv').innerHTML = 'new text'; 
         }    
</script>




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.