隐藏基于单选按钮的元素

时间:2018-06-27 11:41:43

标签: javascript html angularjs

我有这个非常基本的模态。

基本上,模式会更改输入(也许隐藏其他并显示所选的一个),因此我可以通过所需的过滤器进行搜索。

如何根据所选选项更改输入?以及如何默认选择已经存在的选项?

我正在使用angularjs。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<div class="row">
  <label><b>Account ID </b><a data-toggle="modal" href="#filterModal"><i class="glyphicon glyphicon-filter"></i></a></label>
  <div class="row">
    <div class="col-xs-7">
      <input type="number" placeholder="Search by ID" id="accountID" ng-model="accountID" min="1">
      <input type="hidden" ng-model="ticket.ACCOUNT_ID" />
    </div>
    <div class="col-xs-5">
      <button class="btn btn-default w100" type="button">Search</button>
    </div>
  </div>
</div>

<div id="filterModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
         <label class="radio">
                        <input type="radio" value="accountID"> Account ID
                    </label>
        <label class="radio">
                        <input type="radio" value="customerID"> Customer ID
                    </label>
        <label class="radio">
                        <input type="radio" value="name"> Name
                    </label>
        <label class="radio">
                        <input type="radio" value="taxID"> TAX ID
                    </label>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

0 个答案:

没有答案