This button is used to send data via ajax.

<button class="main" style="float: left;" id="send" name="button" value="Post">Написать</button> 

How to press the Enter button to perform the same actions?

    3 answers 3

    Try to play with html events

    • onkeydown is the onkeydown event.
    • onkeyup is a key release event.

    From them try to get the character code, enter - this seems to be 13.

      If the button is in the form, you can change the button

       <input type="submit" class="main" value="Написать" /> 

      If you just need to work out Enter

       $(window).keydown(function(e) { if (e.which == 13) { sendForm() } 

      });

        And if this button do focus() ? Then when you press enter you will click on this button.

        • not a bad idea, but I already did it with the help of keyup jquery - Svyatoslav