mardi 11 août 2015

Table hiding via checkbox

I'm trying to hide the table i have when the checkbox is unticked. I'm doing it wrong because its not working!

Whats missing?

this is my table class

<table class="table table-bordered invoiced">

This is my javascript

  $("input:checkbox:not(:checked)").each(function() {
  var column = "table ." + $(this).attr("name");
  $(column).hide();
});

$("input:checkbox").click(function(){
  var column = "table ." + $(this).attr("name");
  $(column).toggle();
});

and this is my checkbox class

<th><input class="invoiced" type="checkbox" checked> Invoiced Out</th>




Aucun commentaire:

Enregistrer un commentaire