$('.hide-next').click(function() { var parentEls = $(this).parents("div").children('.hide-next') .map(function () { return $(this).text(); }) .get().join("/"); console.info(parentEls); //window.location.hash = parentEls; });