Simulate press key of keyboard when click on button

Simulate press key of keyboard when click on button

Hello,

After much research I request the help of the community jquery

I want to use jquery to simulate the keystroke by pressing a button that will fill a text input

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
  6. <script>
  7. $(document).ready(function() {

  8. $("#press_keyboard").click(function(){
  9. //simulate press key escape or other keys of keyboard in #input_test
  10. // i wont use $("#input_test").val();
  11. });
  12. });
  13. </script>
  14. </head>
  15. <body>
  16. <input type="text" id="input_test">
  17. <button  class="" type='button' id='press_keyboard' >press keyboard</button>
  18. </body>
  19. </html>