[英]How to Disable input field when radio button will choose using angular.js
我需要一個幫助。當單選按鈕將被選中時,我需要禁用一些輸入字段。下面讓我解釋一下我的代碼。
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Unit Cost Price :</span>
<input type="text" name="discount" id="ucp" class="form-control" placeholder="Add unit cost price" ng-model="unit_cost_price" ng-keypress="clearField('ucp');" ng-readonly="ucpread" ng-disabled="ucpdis">
</div>
<div class="input-group bmargindiv1 col-md-12" >
<input type="radio" name="favoriteColors" ng-model="isChecked.new">Add new stock
<input type="radio" name="favoriteColors" ng-model="isChecked.old">Update stock
</div>
在上面的代碼中,我默認情況下選擇Update stock
我需要當用戶選擇Update stock
時,當用戶選擇Add new stock
時,以上Unit Cost Price
字段將被禁用/只讀。請幫助我。
將值賦予單選按鈕,然后對其進行比較以禁用\\啟用文本
<input type="radio" ng-model="isChecked" name="favoriteColors" value="true" />Add new stock
<input type="radio" ng-model="isChecked" name="favoriteColors" value="false" />Update stock
<input type="text" ng-disabled="isChecked=='false'">
檢查此提琴手: http : //jsfiddle.net/ryf2h49p/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.