Skip to content

Instantly share code, notes, and snippets.

@arian
Created August 12, 2011 16:58
Show Gist options
  • Save arian/1142472 to your computer and use it in GitHub Desktop.
Save arian/1142472 to your computer and use it in GitHub Desktop.
select.get('value');
/*<ltIE9>*/
var testForm = document.createElement('form');
testForm.innerHTML = '<select><option>s</option></select>';
if (testForm.firstChild.value != 's') Element.Properties.value = {
get: function(){
var tag = this.get('tag');
if (tag != 'select' && tag != 'option') return this.getProperty('value');
if (tag == 'select'){
var option = this.getSelected()[0];
return option ? option.get('value') : '';
}
var attr = this.getAttributeNode('value');
return (attr && attr.specified) ? this.value : this.get('text');
}
};
/*</ltIE9>*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment