Possible to get hard coded attribute value, not DOM value

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Possible to get hard coded attribute value, not DOM value

Post by josh »

If I have an input tag with a value="foo" attribute, and later the user changes that element's value, how would I get back it's original value without calling reset() on the entire form? Is this possible with DOM scripting in any way?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Possible to get hard coded attribute value, not DOM value

Post by John Cartwright »

Code: Select all

document.getElementById("field").defaultValue
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Possible to get hard coded attribute value, not DOM value

Post by josh »

Thanks! (sounds familiar too) Is there some sort of DOM API documentation that you can recommend (for when I forget again)
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Possible to get hard coded attribute value, not DOM value

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Possible to get hard coded attribute value, not DOM value

Post by josh »

Nice. I'd tattoo it to my inner eyelids but I dont think itd fit.
Post Reply