Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a value before update

Status
Not open for further replies.

mais123

Programmer
Dec 26, 2007
36
US
Hi, I have an input box(asp.net textbox). When user makes a change to the value I need to save the old value forst. What event can I hook up to the box to get the old value? Also how can I get the value that was there before update

Thanks
 
You can get the value that was on the input when it was first delivered to the page (whether you have changed it or not) by looking at the defaultValue property of the input.

Code:
<input id="test" type="text" value="A">
Whether you change the input (or not) you can get the original (default) value using something like:
Code:
document.getElementById('test').defaultValue;
Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top