Click here to Skip to main content
15,881,743 members
Articles / Web Development / ASP.NET
Tip/Trick

Find the key code using javascript

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Nov 2011CPOL 21.8K   1  
In Text box key press event, find the pressed key code value using javascript
HTML
<input type="text" id="txtSearch"  önkeypress="searchKeyPress(event);" />

Java
function searchKeyPress(e)         
    {
        // look for window.event in case event isn't passed in
        if (window.event) { e = window.event; }
        if (e.keyCode == 13) {
           alert('Enter key pressed on the Text Box control'); 
        }         
    }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Mahindra Logisoft Business Solution Limited, Chenn
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --