slandau slandau - 7 months ago 37
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){