在javascript jQuery中搜索日期之间?

时间:2019-07-15 23:25:16

标签: jquery

我有一个带有2个单选按钮和一个搜索按钮的数据表,我想将年和日期月份分别放在2和3个数据表单元格中,同时当我检查rb1并单击按钮数据表搜索时,显示日期时钟在01 /月/年之间和15 /月/年,对于数据表rb2,显示打孔在16 / m / y和31 / moth /年之间。

<div class="form-check form-check-inline">
            <label class="form-check-label" for="btnf1">1st fortnight</label>
            <input type="radio" class="form-check-input" id="btn1" name="btnRadio" checked>

            <label class="form-check-label" for="btnf2">2nd fortnight</label>
            <input type="radio" class="form-check-input" id="btn2" name="btnRadio">
          </div>
          <div class="form-group col-md-offset-5 ">
            <button class="btn btn-success " id="hide">Rechercher</button>
          </div>
      <table class="table table-bordered" id="mytable">
            <thead>
                      <tr>
                        <th><input type="checkbox" id="check_all"></th>
                        <th>year</th>
                        <th>month</th>
                        <th>salaries</th>
                        <th>chantier</th>
                        <th>date</th>
                      </tr>
                    </thead>
                    <tbody>
                        <tr id="tr_">
                          <td><input type="checkbox" class="checkbox"></td>
                          <td><input type="hidden" class='year' class="form-control" /></td>
                          <td><input type="hidden" class='month' class="form-control" /></td>
                          <td>najib</td>
                          <td>harbil</td>
                          <td>01/01/2019</td>
                        </tr>
                        <tr id="tr_">
                          <td><input type="checkbox" class="checkbox"></td>
                          <td><input type="hidden" class='year' class="form-control" /></td>
                          <td><input type="hidden" class='month' class="form-control" /></td>
                          <td>ali</td>
                          <td>najd</td>
                          <td>20/01/2019</td>
                        </tr>
                    </tbody>
            <tfoot>
                 <tr>
                        <th></th>
                        <th>year</th>
                        <th>month</th>
                        <th>salaries</th>
                        <th>chantier</th>
                        <th>date</th>
                 </tr>
            </tfoot>
      </table>

jQuery代码

 $(document).ready(function () {
        $('#check_all').on('click', function(e) {
         if($(this).is(':checked',true))  
         {
            $(".checkbox").prop('checked', true);  
         } else {  
            $(".checkbox").prop('checked',false);  
         }  
        });
         $('.checkbox').on('click',function(){
            if($('.checkbox:checked').length == $('.checkbox').length){
                $('#check_all').prop('checked',true);
            }else{
                $('#check_all').prop('checked',false);
            }
         });

          let year=$('#year').val();;
          let month=$('#month').val();

           $('.year').val(year);
           $('.month').val(month);
         });

0 个答案:

没有答案
相关问题