[thelist] Toggle disable/enable of text box
jeff
jeff at members.evolt.org
Thu Jan 18 23:07:31 CST 2001
bart,
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Miller, Bart
:
: I have a form where I want to disable an
: input box if a checkbox is checked (see
: code below). Now, it works fine when I
: check the box. But when I uncheck the
: box it does not become enabled again.
: I only need this to work in IE5+
: browsers. Is this a bug?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
no, it's not a bug. it's a syntax problem. you're setting the value of the
disabled property to a string, not a boolean. what's more, the syntax
you're using is verbose and unnecessary since the this.checked test already
returns a boolean of true of false. here's how i'd do it.
<input
type="checkbox"
onclick="this.form.test.disabled = this.checked">
<input name="test" value="Enter text here">
good luck,
.jeff
name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org
More information about the thelist
mailing list