I have a function that is called whenever a select changes. If the select had an ID of "foo" there'd be a text field with an ID of "foo_other" after it that by default is styled "display:none".
If a value of "Other" is picked from the select, the function is supposed to display the text field, and set focus to it. If anything other than "Other" is chosen, it should hide the field and remove anything entered.
Works in FF, IE throws an error "Object required". I was trying to avoid doing an eval() around the dynamic variable... Any help is appreciated.
Code:
function checkOther(inObj){ var other_form_id = inObj.name + "_other"; if(inObj.value == 'Other') { document.getElementById(other_form_id).style.display = 'inline'; document.getElementById(other_form_id).focus(); } else { document.getElementById(other_form_id).style.display = 'none'; document.getElementById(other_form_id).value = ''; } }