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.