View Full Version : Javascript - enable/disable text box
kabatak
February 16th, 2003, 08:40
Hi, How do you make a function that will enable a text box when a user clicks "others" in the drop down menu.. http://kabatak.ultradesigns.net/help.htm
Cagez
February 16th, 2003, 11:06
<script language="javascript">
function dis_able()
{
if(document.myform.D1.value != 'Others')
document.myform.otherz.disabled=1;
else
document.myform.otherz.disabled=0;
}
</script>
<form name="myform">
Category: <select size="1" name="D1" onChange="dis_able()">
<option>Category A</option>
<option>Category B</option>
<option>Catagory C</option>
<option value="Others">Others</option>
</select><br>
Others pls specify: <input disabled type="text" name="otherz" size="20" value="pls specify"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
You have to give a name to your form, and give your options value's. I gave your Other option the value of other so it'll work :)
kabatak
February 16th, 2003, 11:28
that looked easy man :) im just a bit confused on proper syntax and attributes, thanks a lot! i'v been asking a lot of ppl about this and your the only one who answered correct. :)
Cagez
February 16th, 2003, 21:13
lol your welcome :D
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.