appendInputTypeClasses() - IE attribute selectors for form inputs
(Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38).
Unobtrusive script takes a form inputs type attribute and copies it to that input's class. So, you go from...
...to...
Basically allows attribute selectors for form until IE catches up.
Unobtrusive script takes a form inputs type attribute and copies it to that input's class. So, you go from...
<input type="text" />
...to...
<input type="text" class="text" />
Basically allows attribute selectors for form until IE catches up.
/* form.js AUTH: Austin Govella ([email protected]) DATE: 2006-07-01 DESC: Includes form specific javascripts. NOTE: Stolen from Jeremy Keith and Dustin Diaz: http://domscripting.com/blog/display/38 REVS: */ function appendInputTypeClasses() { /* adds input type as the inputs class */ if ( !document.getElementsByTagName ) return; var inputs = document.getElementsByTagName('input'); var inputLen = inputs.length; for ( i=0; i < inputLen; i++ ) { if ( inputs[i].getAttribute('type') ) { inputs[i].className += ' '+inputs[i].getAttribute('type'); } } }