Trying to add script for: Enter Key (keypress) to select a button on form

  • 27 April 2022
  • 1 reply
  • 80 views

Trying to add JS to a data label, that will select a specific button if the enter key is pressed from within a specific text box. 

 

<script>
$('[name="text box"]').keypress(function(event)
   
    { if(event.keyCode == 13)
    { $('[name="button"]').click(); }
    });
</script>
 
Tried this script here, but nothing happens on the keypress. 

1 reply

Found the issue, in case others run into something similar. It looks like this script will not run for a picture click. I changed the search action to a button and the script ran perfectly on a button. 

Reply