This is my html
<input type="radio" formControlName="customertype" onclick="myfunction()" value="option1" checked/>
<input type="radio" formControlName="customertype" value="option2"/>
<input type="text" name="organisationname" disabled="disabled" id="organisationName1" formControlName="organisationname" placeholder="Orgranisation name" aria-label="First name"/>
<button type="button" [disabled]="registrationform.invalid" >Submit</button>
<button type="reset" (click)="resetbtn()" >Reset</button>
<button type="button" >Cancel</button>
CodePudding user response:
<input
type="radio"
id="setDisabledTrue"
onclick="if (checked) textbox.disabled = true"
name="isTextBoxDisabled"
>
<label for="setDisabledTrue">Disabled</label>
<br>
<input
type="radio"
id="setDisabledFalse"
onclick="if (checked) textbox.disabled = false"
name="isTextBoxDisabled"
>
<label for="setDisabledFalse">Not disabled</label>
<br>
<br>
<input type="text" id="textbox">
CodePudding user response:
function enable() {
document.getElementById('text').disabled = false;
}
function disable() {
document.getElementById('text').disabled = true;
}
<input type="radio" name="disable" value="false" onChange="enable()" checked>Enable
<input type="radio" name="disable" value="true" onChange="disable()">Disable
<br>
<textarea id="text">
</textarea>