I have list of checkboxes for genre filters. Here is HTML
<div class="gl-title">Türler</div>
<ul class="check-list filters" id="genres">
<?php foreach($genres as $genre){?>
<li>
<div class="customCheck">
<input type="checkbox" data-genrename="<?php echo $genre->slug; ?>" id="tur_<?php echo $genre->term_id;?>">
<label for="tur_<?php echo $genre->term_id;?>"></label>
</div>
<div class="cl-text">
<?php echo $genre->name;?>
</div>
</li>
<?php }?>
</ul>
</div>`
On checkbox click i want to add genrename at the end of the url.Here is my JQuery code
$(".customCheck").children("input").unbind(click).click(function(){
if ($(this).is(":checked")) {
$(this).prop("checked", false);
} else {
$(this).prop("checked", true);
}
alert("blabla");
var curUrl = window.location.href;
alert(curUrl);
if(curUrl.substring("?tur=")>-1){
window.location=curUrl+"+"+$(this).attr("data-genrename");
}else{
window.location=curUrl+"?tur="+$(this).attr("data-genrename");
}
});
"tur" means genre in my language.(For you can understand url.) This function is under document ready.Checking functions are working but i can't see alert box on click. I tried with incognito mode for caches nothing changed. What is problem Thanks so much
Aucun commentaire:
Enregistrer un commentaire