Disabling Text on Radio Click [resolved]
I have several radio buttons on my site with the following tags.
HTML Code:
<INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio A" SELECTED>
<INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio B">
<INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio C">
Then I have and input field with the following tag.
HTML Code:
<div id="first_name">
First Name:
</div>
<INPUT TYPE="text" NAME="first_name" SIZE="20" MAXLENGTH="10" ONCHANGE="this.value = this.value.toUpperCase()">
What do i need to do to have the First Name label and the text box disabled when I click on Radio A. And have it enabled when i click on B or C. Keep in mind that when the page loads A is selected already. So it needs to load disabled.
Thanks for you help
Re: Disabling Text on Radio Click
You need to catch onclick on all three radios. See which one is selected. If it's A, disable the text field, otherwise enable it. On page load, do the same. (If you put the disabled attribute on the text field, it would be disabled on load, but if the user has JS disabled, it would stay so, which is not good.)
Re: Disabling Text on Radio Click