javascript - Bind enter key to specific button on page -
<input type="button" id="save_post" class="button" value="post" style="cursor:pointer;"/>
how can bind enter key on persons keyboard specific button on page? it's not in form, , nor want be.
thanks!
this click button regardless of "enter" happens on page:
$(document).keypress(function(e){ if (e.which == 13){ $("#save_post").click(); } });
Comments
Post a Comment