如何启用禁用文本框上的单选按钮点击



这是我的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"  class="form-control" placeholder="Orgranisation name" aria-label="First name"/> 
<button type="button"  [disabled]="registrationform.invalid"  class="btn btn-outline-primary buttonspace">Submit</button>
<button type="reset" (click)="resetbtn()" class="btn btn-outline-secondary buttonspace">Reset</button>
<button type="button" class="btn btn-outline-danger buttonspace">Cancel</button>

<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">

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>

最新更新