I am writing a small script to test if a form has been altered before it has been submitted. So normal inputs (text, textarea, etc) I can use:
if(element.defaultValue != element.value) { altered[element.name] = element.value; element.value = element.defaultValue; } This works fine. But it appears the select inputs don't have one to check against. Although in Firebug it does appear in the DOM listing, but in black (instead of green) which I believe means that it's added by the browser (correct me if I'm wrong).
If I log the element.defaultValue for a select element it returns undefined.
So my question, does select have a defaultValue attribute? Or some alternative that I can leverage?