Jump to content

Catch A User Initiated Onchange Event


ShadowMage
 Share

Recommended Posts

I have a situation that I'm not sure I can get the solution I want. I have a text box that should update some total values on my page whenever it changes. Trouble is I want the value of that box to be automatically calculated until the user manually changes it. If the user has manually changed its value then it should no longer calculate automatically.Here is what I want to know: Is there a way to distinguish between a user initiated onchange and a programmatically initiated onchange?Hope I've been clear enough.Any advice/help is greatly appreciated, Thank youjkloth

Link to comment
Share on other sites

I don't have access to IE at the moment, but FF, Safari, and Opera do not fire a change event when a text input value is changed programmatically. If IE is the same, you have your answer.Remember that text elements do not fire a change event until the element loses focus: eg, when the user clicks something outside the box. I don't know if that makes a difference to your situation.Remember too it is always possible to capture key events in a text element. Some applications like to make instant updates based on individual keystrokes.

Link to comment
Share on other sites

Experiment! Always! :) My computer desktops are all cluttered with tiny HTML files that test 1-2 things at a time. I keep them for a while, then trash them, and in a week my desktop is full again. A lot of them are things I try out before I respond on this board. I learn a lot that way.It helps that I have a template file linked to my editor. That way I only have to add a little bit of code/markup to test the thing I'm after.

Link to comment
Share on other sites

I usually do. I don't know why I didn't this time. I feel like such a doofus if I post a simple question (like this one) that I could have figured out if I had taken a little bit of time to experiment.That's the reason for the Test page I built on the company intranet. It's a personal document that only I have access to and I can experiment with it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...