[RESOLVED] .defaultValue for a dropdown?
I can simply add a hidden field to keep track of the value but I'm not sure if there is a better way to do it.
Radio & Checkbox = defaultChecked
Doesn't look like drop down list has one.
Not sure if this is what you are looking for, because I think this will only tell you if any individual input was checked or not, not for the entire group what was checked. Could be wrong on this though.
Just save the select tag's value when the page first loads:
Then you can use that later, even if it changes:
var selectDefault = selectTag.value;
if (selectTag.value != selectDefault) // Value has changed
Are you talking about the "selected" option in a droplist?
<option value="DefaultValue" selected>Default Item</option>
<option value="AnotherValue">NOT Default Item</option>
Thank you both for your replies. You pointed me in the right direction.
There is a defaultSelected property for <option> elements, similar to defaultChecked for radio buttons and checkboxes. But there doesn't appear to be any property to get the value of the collective group of elements (i.e. selectTag.defaultSelected).
I can either loop through the elements or just store the value somewhere, like a hidden field or a var like Y_Less suggested.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread