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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -