$(document).ready(function(){ $('input[class="inputForm"]').bind('keydown',function(e){ if(e.keyCode == 13 && e.ctrlKey){ e.preventDefault(); alert('Tecla de atalho com JQuery!'); } }); $("div[id='btSend']").bind("click",function(){ alert('Tecla de atalho com JQuery!'); }); });
<fieldset> <legend>Clique no campo nome e pressione CTRL + ENTER</legend> <form action="" method="post" id="formFuncao" name="formFuncao" onSubmit="return false;"> <label for="txtNome">Nome</label> <input name="txtNome" type="text" class="inputForm" id="txtNome" width="100" placeholder="Press. CTRL + ENTER"/> <div id="btSend" class="bt btBlue">Enviar</div> <div id="btClear" class="bt btWhite">Limpar</div> </form> </fieldset>
#btClear { float: right; width: 80px; } .btWhite { background-color: #FFFFFF; border-color: #999999; color: #777777; } #btSend { float: right; width: 80px; } .btBlue { background-color: #0097B4; border-color: #555555; color: #FFFFFF; } .bt { border: 1px solid; cursor: pointer; font-weight: bold; height: 19px; line-height: normal; margin-left: 10px; margin-top: 10px; padding: 3px; text-align: center; }