I am new in web development. I want to append bread crumbs based on click. this script is basically added only one like from the first li if I select second then it update second I want it to add more like if I checked the first name then add like home/ first and if I click on second it update Home/first/second in this format I want and both of them together but nothing works like if I have selected the first two from the first filter and three four from second then it will look like Home/first/second/third/four and also remove from breadcrumbs if I second click and vice versa
$('.categories a, .second li input ').on('click', function() {
var $this = $(this),
$bc = $('<div class="item"></div>');
$this.parents('li').each(function(n, li) {
var $a = $(li).children('a').clone();
$bc.prepend(' / ', $a);
});
$('.breadcrumb').html( $bc.prepend('<a href="#home">Home</a>') );
return false;
})
$('.breadcrumb').html( $bc.prepend('<nav class="breadcrumb"><a href="mydomain.com">Mydomain</a><span class="breadcrumb-separator"> / </span>All </nav>') );
试试这个
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.