CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009

    How do you do Keyup Event in Javascript.

    Hello everyone.

    I'm trying to code either the keyup or keypress event for an input field in javascript but can't find any good sample code on how to do it. The example on www.w3schools.com doesn't work for me. Can someone please help me with this?

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002

    Re: How do you do Keyup Event in Javascript.

    It's pretty basic code. Not sure how W3Schools could mess it up.

    <script type="text/javascript">
    function chkKey(e) {
      if (e.keyCode == 13) {
        window.alert("Return key");
    <input type="text" name="textbox" onkeydown="chkKey(event)">
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Dec 2009

    Re: How do you do Keyup Event in Javascript.

    I replaced the body of the function with a simple alert('test'); just to simplify it some and tested the code in IE and Firefox and it worked just fine. Super thanks my friend.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.