Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7088061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:45:04+00:00 2026-05-28T07:45:04+00:00

Once the user preses a, the button colour will change, then once the user

  • 0

Once the user preses “a”, the button colour will change, then once the user releases the “a” button it should change again. The button only changes colour once the letter “a” has been pressed, not when released.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>website</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    $(document).keyup(function(event) {
        if ( event.which == 97){
            $('.button0 input').css('color', 'rgb(0, 0, 255)');
        }
    });
    $(document).keypress(function(event) {
        if ( event.which == 97){
            $('.button0 input').css('color', 'rgb(128, 0, 0)');
        }
    });
});
</script>
<style type="text/css">
.button0 input{
    position:fixed;
    left:41px;
    top:12px;
    font-family:Arial;
    font-size:8px;
    font-weight:normal;
}
</style>
<body>
    <div class="button0">
        <input type="button" style="width: 303px;height: 165px;" value="Button"/>
    </div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:45:05+00:00Added an answer on May 28, 2026 at 7:45 am

    From the jQuery API page for .keypress():

    Note that keydown and keyup provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase “a” will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase “A” is reported as 65 by all events. Because of this distinction, when catching special keystrokes such as arrow keys, .keydown() or .keyup() is a better choice.

    So you need to change event.which == 97 to event.which == 65 in your keyup handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Once a user has selected a file with the open file dialog, how can
I have the following route: {language}/{controller}.mvc/{action}/{id} Once a user has choosen the language it
Once user presses button, new activity is shown with animation. What is the name
I am creating a method that is run once a user presses a button.
I have a webpage that requires login. Once a user has logged in I
How do I make this so once the user inputs a number and presses
Once a user starts a session (or logs in, for a registered user, to
Let's say that I have a site where once the user selects a few
hi all i'm trying to perform an action once the user double clicks on
I've added the following code to my masterpage (Page_Load) so once a user logs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.