Created
December 22, 2010 20:14
-
-
Save ricardobeat/752033 to your computer and use it in GitHub Desktop.
Adds classes to input elements in Internet Explorer according to it's type
This file contains 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
// ================================================ | |
// workaround para seletor de atributos type (ex: [type=text]) no IE6 | |
// cria classe type_valorDoAtributo | |
// repetir no CSS (não pode estar no mesmo seletor): | |
// input[type=text] { x:y; } | |
// input.type_text { x:y; } | |
// - | |
(function(){ | |
if (! ($.browser.msie && $.browser.version < 7) ) | |
return false; | |
var inputs = document.getElementsByTagName('input') | |
, ln = inputs.length | |
, input | |
, type; | |
while(ln--){ | |
input = inputs[ln]; | |
type = (input.getAttribute ? input.getAttribute('type') : input.type) || "text"; | |
input.className = (input.className + ' type_' + type).replace(/^\s+/, ''); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment