Hi all,
May i know, how to run function when user press ENTER button after they key-in some value on textbox?
Condition:
User keyin Employee No on textbox and press ENTER button. System will run the function.
Thanks
Dear Andrea,
Thanks for your feedback but sorry i'm not understand.
Can you provide sample code on VB.net. Thanks
Hi asrul,
Check the below code.
HTML
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { var txtName = $('[id *= txtName]'); $(txtName).keypress(function (event) { var keyCode = event.keyCode; if (keyCode == 13) { alert('You have entered employee no - ' + txtName.val()); txtName.val(''); event.preventDefault(); } }); }); </script> </head> <body> <form id="form1" runat="server"> <div> <input name="txtName" type="text" id="txtName" placeholder="Enter Employee No" /> </div> </form> </body> </html>
Its great!!! thanks a lot dharmendr
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.