Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript function to enable textfield on dropdown select Re: Javascript function to enable textfield on dropdown select

#67859
BaylorRae
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;
}
}

HTML:

Code: