1 // Find select-or-other fields.
2 addOnloadHook( function() {
3 var fields
= getElementsByClassName( document
, 'select', 'mw-htmlform-select-or-other' );
5 for( var i
= 0; i
< fields
.length
; i
++ ) {
6 var select
= fields
[i
];
8 addHandler( select
, 'change', htmlforms
.selectOrOtherSelectChanged
);
10 // Use a fake 'e' to update it.
11 htmlforms
.selectOrOtherSelectChanged( { 'target': select
} );
16 'selectOrOtherSelectChanged' : function( e
) {
23 } else if ( e
.srcElement
) {
24 select
= e
.srcElement
;
26 if ( select
.nodeType
== 3 ) { // defeat Safari bug
27 select
= select
.parentNode
;
31 var textbox
= document
.getElementById( id
+ '-other' );
33 textbox
.disabled
= ( select
.value
!= 'other' );