Hi, I am trying to use jQuery to hide some items in a list to only show the trail of the selected node.
See this JSFiddle for the markup:
http://jsfiddle.net/QLbAS/4/
See this JSFiddle for the markup:
http://jsfiddle.net/QLbAS/4/
$(document).ready(function($) {
$(function() {
$(".s4-ql ul.root ul li").hide();
$("li.selected").parents("li").andSelf().each(function(index,elem) {
$(this).siblings().andSelf().show();
});
$("li.selected").children("ul").children("li").show();
});
});
Just FYI, you've got two document ready handlers there, you can cut out the first one:
Code:$(function() { $(".s4-ql ul.root ul li").hide(); $("li.selected").parents("li").andSelf().each(function(index,elem) { $(this).siblings().andSelf().show(); }); $("li.selected").children("ul").children("li").show(); });