dimanche 4 février 2018

How to get the value of SVG checkbox

I have a list with checkboxes and brandnames. When I click on one of the brands the page must reload and show a checked checkbox. The page reloads, but the brand in the url category-listing-brand.php?brand= is empty (and also the checkbox). So how can I get the value from this code?

<li><a href="javascript:void(0);" class="item_filter brand" <?php if(in_array($brand_data['brandshort'],$brand)){ echo"checked"; } ?>>
 <span <?php if(in_array($brand_data['brandshort'],$brand)){ echo"class='checked'"; } ?>><svg class="svg-icon-tick"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-icon-tick" ></use></svg></span>
 <?php echo $brand_data['brand']; ?></a></li>    

$(function(){
  $('.item_filter').click(function(){
   var brand = multiple_values('brand');

   var url ="category-listing-brand.php?brand="+brand+"&page=1";
   window.location=url;
  });
 });

 function multiple_values(inputclass){
  var val = new Array();
  $("."+inputclass+":checked").each(function() {
   val.push($(this).val());
  });
 return val.join(',');
}




Aucun commentaire:

Enregistrer un commentaire