当我点击五个前四个单选按钮时如何获取文本框区域?

时间:2015-03-24 07:34:55

标签: html angularjs

当我点击前四个单选按钮文本框时,我有一个带有5个单选按钮的问题,并且必须隐藏第五个单选按钮文本框

<input type="radio" name="satisify" ng-model="color" value="1" id="1star_Rate">
<input type-"text" id="txthdbh" ng-show="color=='1'">

1 个答案:

答案 0 :(得分:0)

在单选按钮上使用ng-model有两个双向绑定。现在在文本框中使用ng-show,这将取决于单选按钮的模型值

 <script language="javascript">
        var questions = angular.module("questions", []);
        questions.controller("questionsCtrl", function($scope) {
            $scope.answer = "chennai";
        });
    </script>
<body ng-app="questions" ng-controller="questionsCtrl">
    <div>which city you are from?</div>
    <div ng-bind="answer"></div>
    <input type="radio" ng-model="answer" value="chennai"/> chennai <br/>
    <input type="radio" ng-model="answer" value="mumbai" />mumbai <br />
    <input type="radio" ng-model="answer" value="calcutta" />calcutta <br />
    <input type="radio" ng-model="answer" value="delhi" />delhi <br />
    <input type="radio" ng-model="answer" value="other" />other <br />
    <input type="text" ng-show="answer!='other'" />
</body>