slandau slandau - 1 month ago 5x
HTML Question

Bind enter key to specific button on page

<input type="button" id="save_post" class="button" value="Post" style="cursor:pointer;"/>

How can I bind the enter key on the persons keyboard to this specific button on the page? It's not in a form, and nor do I want it to be.



This will click the button regardless of where the "Enter" happens on the page:

    if (e.which == 13){