Created
August 12, 2011 16:58
-
-
Save arian/1142472 to your computer and use it in GitHub Desktop.
select.get('value');
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*<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