lundi 12 janvier 2015

Multiple check box's and Jquery

I have multiple checkboxs (26). Their id "check-box-1" , "check-box-2" etc. How to make these checkboxes work in code $('#check-box-').prop('checked', true); so script (or css) will add automaticly #check-box-1 or #check-box-2 according to link adress.



$(function() {
$('a[href*=#]:not([href=#])').click(function() {
$('#check-box-').prop('checked', true);
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}

}
});
});




Aucun commentaire:

Enregistrer un commentaire