如果选中隐藏/显示复选框为真

时间:2016-09-15 03:39:39

标签: javascript jquery angularjs checkbox

我正在编写一个应用程序,其中div具有日期,开始时间,结束时间和位置。我有两个复选框:

  1. 添加附加(复选框) - 如果选中,则会添加另外一组包含相同内容(日期,时间,地点)的div。

  2. 时间/地点将相同(复选框) - 如果我选中此复选框,然后检查第一个,则只有日期将添加到新div。所有开始时间,E时间和位置都将被隐藏。

    <input type="checkbox" 
           ng-click="addMore(keyAdd)" 
           ng-model = "keyAdd" 
           ng-disabled="keyCount>2"> 
    <label for="keyAdd">Add Additional</label>
    &nbsp;
    &nbsp;
    <input type="checkbox"  
           ng-model = "keyOnlyDate" > 
    <label for="configDate">Time/Place will be the same</label> 
    
  3. 我的控制器

    在控制器上点击即使我正在调用addMore功能。根据当前实现,它隐藏了当前行的时间/位置。 如何隐藏下一个。

      $scope.addMore = function(Attr){
         if (Attr && $scope.keyCount <= 2 && $scope.keyOnlyDate == false) {
    
            // $scope.selects.push({'datePicker':'','timePiker':''});
             $scope.selects.push({commDate : null,commEtime: null,commStime: null,configLoc:''});
                    $(".dateContainer div.timePiker:last").show();
                    $(".dateContainer label.configLocation:last").show();
                    $(".dateContainer input.form-control:last").show();
    
             $scope.keyCount++;
             $scope.keyAdd = false;
             $scope.keyOnlyDate = false;
         }
         else if(Attr && $scope.keyCount <= 2 && $scope.keyOnlyDate == true){
    
             $scope.selects.push({commDate : null});
    
                $(".dateContainer div.timePiker:last").hide();
                $(".dateContainer label.configLocation:last").hide();
                $(".dateContainer input.form-control:last").hide();
            // $(".timePiker").hide();
             $scope.keyCount++;
             $scope.keyAdd = false;
             $scope.keyOnlyDate = false; 
         }
    

0 个答案:

没有答案
相关问题