vendredi 15 décembre 2017

jQuery Checkbox with multiple filters

I am trying to add two filtering options using check boxes. The first would filter the divs based on who the thing is assign to (in this case Nangle or Fahon) and a second filter based on the status (in this case either Todo or Pending Us). Below is my code so far.

$(document).ready(function(e) {
  $('input[type="checkbox"]').click(function() {
    var inputValue = $(this).attr("value");
    $("." + inputValue).toggle();
  });
});
<link href="http://ift.tt/2apRjw3" rel="stylesheet"/>
<script src="http://ift.tt/1oMJErh"></script>
<div class="span6">
  <div class="portlet box blue checkbox-assigned">
    <div class="portlet-title">
      <div class="caption"><i class="icon-globe"></i>Jobs</div>
    </div>

    <label><div class="checker"><span class="checked"><input type="checkbox" name="colorCheckbox" value="76" checked=""></span></div> Fahon</label>

    <label><div class="checker"><span class="checked"><input type="checkbox" name="colorCheckbox" value="60" checked=""></span></div> Nangle</label>


    <label><div class="checker"><span class="checked"><input type="checkbox" name="colorCheckbox" value="Todo" checked=""></span></div> Todo</label>

    <label><div class="checker"><span class="checked"><input type="checkbox" name="colorCheckbox" value="Pending Us" checked=""></span></div> Pending Us</label>
  </div>
  <div style="height: 500px; overflow-y: scroll">
    <div class=" 76 Todo">


      <div class="dashboard-stat green jobsCard" data-assigned="Fahon" data-status="Todo">
        <div>
          Shop Name: <strong style="padding-right: 3em">Pizza</strong> Job Name: <strong>Machine not working</strong> -
          <strong>Todo</strong>
          <a style="float: right; color: #000000;">Priority: <strong>Normal</strong></a> </div>

        <div>
          Created By: <strong>Nangle</strong>
          <a style="float: right; color: #000000;">Assigned To: <strong>Fahon</strong></a>

        </div>
        <div>
          Created On <strong>24/10/2017</strong> Last Updated: <strong>24/10/2017 11:14</strong>
          <a style="float: right; color: #000000;" href="index.php?/job/view/43"><strong>View</strong></a>
        </div>
      </div>
      <div class="containerr collapsed">
        <div class="headerTab"></div>
        <div class="content dashboard-stat blue">
          <p> message </p>
        </div>
      </div>
    </div>
    <div class=" 60 Todo">


      <div class="dashboard-stat green jobsCard" data-assigned="Fahon" data-status="Todo">
        <div>
          Shop Name: <strong style="padding-right: 3em">The Castle</strong> Job Name: <strong>Accounts</strong> -
          <strong>Todo</strong>
          <a style="float: right; color: #000000;">Priority: <strong>Normal</strong></a> </div>

        <div>
          Created By: <strong>Nangle</strong>
          <a style="float: right; color: #000000;">Assigned To: <strong>Nangle</strong></a>

        </div>
        <div>
          Created On <strong>24/10/2017</strong> Last Updated: <strong>24/10/2017 11:19</strong>
          <a style="float: right; color: #000000;" href="index.php?/job/view/44"><strong>View</strong></a>
        </div>
      </div>
      <div class="containerr collapsed">
        <div class="headerTab"></div>
        <div class="content dashboard-stat blue">
          <p> message </p>
        </div>
      </div>
    </div>
    <div class=" 76 Todo">


      <div class="dashboard-stat green jobsCard" data-assigned="Fahon" data-status="Todo">
        <div>
          Shop Name: <strong style="padding-right: 3em">Time</strong> Job Name: <strong>Marketing Visit</strong> -
          <strong>Todo</strong>
          <a style="float: right; color: #000000;">Priority: <strong>Normal</strong></a> </div>

        <div>
          Created By: <strong>Nangle</strong>
          <a style="float: right; color: #000000;">Assigned To: <strong>Fahon</strong></a>

        </div>
        <div>
          Created On <strong>25/10/2017</strong> Last Updated: <strong>25/10/2017 10:32</strong>
          <a style="float: right; color: #000000;" href="index.php?/job/view/51"><strong>View</strong></a>
        </div>
      </div>
      <div class="containerr collapsed">
        <div class="headerTab"></div>
        <div class="content dashboard-stat blue">
          <p> message </p>
        </div>
      </div>
    </div>
    </div>
  </div>
</div>



Aucun commentaire:

Enregistrer un commentaire