Page 1 of 1

Possible to get hard coded attribute value, not DOM value

Posted: Thu Dec 10, 2009 3:41 am
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?

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

Posted: Thu Dec 10, 2009 3:57 am
by John Cartwright

Code: Select all

document.getElementById("field").defaultValue

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

Posted: Thu Dec 10, 2009 5:47 am
by josh
Thanks! (sounds familiar too) Is there some sort of DOM API documentation that you can recommend (for when I forget again)

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

Posted: Thu Dec 10, 2009 7:59 am
by VladSun

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

Posted: Thu Dec 10, 2009 1:50 pm
by josh
Nice. I'd tattoo it to my inner eyelids but I dont think itd fit.