Display Text From Textbox on Enter Key Press

1. Add jQuery on page.

  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>  
2. Add HTML textarea.
  1. <textarea id="txtcomment" placeholder="Type your comment here and press Enter Key...."></textarea>  
3. Add script after text area.
  1. <script type="text/javascript">  
  2. $('#txtcomment').keypress(function (event) {  
  3.    var keycode = (event.keyCode ? event.keyCode : event.which);  
  4.       if (keycode == '13') {  
  5.          alert($('#txtcomment').val());  
  6.          savecomment($('#hdnBlogid').val(), $('#txtcomment').val());  
  7.       }  
  8.       event.stopPropagation();  
  9.    });  
  10. </script>  
4. Run the html page and type in textbox when you press enter that time you can see one alert box with textbox value.