Home › Forums › JavaScript › Javascript function to enable textfield on dropdown select › Re: Javascript function to enable textfield on dropdown select
December 8, 2009 at 6:56 pm
#67859
Member
Start by validating your code. It will not pass. Among other things, you use uppercase letters in attribute names, such as onChange, which is valid HTML but invalid XHTML. Then you close your input tags with /> which is valid XHTML and invalid HTML.
I changed a few of the name attributes when I rebuilt this, so you’ll have to adjust the code.
Javascript:
Code:
function disable_input() {
if( document.form.categories.value == ‘other’ ) {
document.form.other.disabled = false;
}else {
document.form.other.disabled = true;
}
}
if( document.form.categories.value == ‘other’ ) {
document.form.other.disabled = false;
}else {
document.form.other.disabled = true;
}
}
HTML:
Code: