/ Published in: JavaScript
![](/img/icon_sav.png?v3)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('#textBoxId').keydown(function(e) { if(e.keyCode === 13) { e.preventDefault(); $('#buttonId').trigger('click'); } }); or - not tested: $('#textBoxId').keydown(function(event) { var e = event || window.event; var keyCode = document.all ? e.keyCode : e.which; if (keyCode == 13) { e.preventDefault(); $('#buttonId')[0].click(); } });
URL: http://stackoverflow.com/questions/494076/jquery-and-asp-net-forcing-button-click
Comments
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)