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

  • Home
  • SEARCH
  • 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 9188491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:01:16+00:00 2026-06-17T20:01:16+00:00

I have a form with input fields (storing prices for each object) that have

  • 0

I have a form with input fields (storing prices for each object) that have different events for keyup, blur, and keypress. When the user tabs through the fields, my JS loops through each input field to check if it has been changed from its previous value (and perform a calculation based on that). (I tried using the .change and .keypress events instead – unfortunately they were timed to fire AFTER keyup, and it needs to be before).

I store a global variable array of the each input’s initial value and check the current value against that. But for some reason, when I loop through each input and check its .val(), the effect is that the user’s currently selected input gets deselected. Same happens for .attr(“value”). I’ve debugged sufficiently to know that this particular call is the issue – substituting a random number instead of calling .val(), for example, causes it to work perfectly. Any ideas why this is happening?! I’m at my wit’s end.

  • 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-06-17T20:01:17+00:00Added an answer on June 17, 2026 at 8:01 pm

    For the sake of clarity, and not wanting to leave this question appear unanswered, I’m repeating the accepted answer from the comments section also here:

    The order of events related to the onkeydown event: onkeydown ->
    onkeypress -> onkeyup

    Answer taken from w3schools.com. Using onkeydown event instead seems to have solved the OP’s dilemma:

    (I tried using the .change and .keypress events instead –
    unfortunately they were timed to fire AFTER keyup, and it needs to be
    before)

    😉

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

Sidebar

Related Questions

I have a form with different html input fields... 1) <input type=text> 2) <textarea></textarea>
I have a form with a few input fields. When a user clicks on
I have a form with a large number of fields that I am storing
I have a form that has placeholders for input fields. It uses html5 placeholder
I have a form with input fields and a button which fades in when
I am using Codeigniter framework and I have a form with input fields. When
I have form where are 2 input fields and then i have dynamic dataTables
I have a form with some input fields. I am using the tabStrip KendoUI
I have a form with some input fields and a little <div> to the
I have a form with two input text fields: <input id=ModelName_test_0 name=ModelName[test][0] type=text> <input

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.