Create a shortcut key to submit a form

Create a shortcut key to submit a form

I want to create a shortcut key(ctrl+s) to submit the form:

 

so i have the form:

<form action=”action_page.php” id=”editForm”>

<fieldset>
<legend>Personal information:</legend>
First name:<br>
<input type=”text” name=”firstname” value=”Mickey”><br>
Last name:<br>
<input type=”text” name=”lastname” value=”Mouse”><br><br>
<input type=”submit” value=”Submit”>
</fieldset>
</form>

the magic code that will make things happen is:

 

<script>
jQuery(document).bind(‘keydown’, ‘ctrl+s’,function (evt){
document.getElementById(“editForm”).submit();
return false;
});
</script>


Related Articles

SQL change part of a string

  UPDATE Table_Name SET Column_Name = REPLACE(Column_Name, ‘Text_To_Be_Replaced’, ‘New_Text’) WHERE Column_Name LIKE ‘%Text_To_Be_Replaced%’

Create a controller with populated with all the functions a

#php artisan make:controller FlyersController –resource the result is that you will have a controller with all the functions created: <?php

Disable autofocus input

$(function(){ $(‘input’).blur(); });