Would this work? $(function(){ $(".collapsable a").click(function(e){ e.preventDefault(); }); });
On Jul 8, 1:42 pm, Cedd Burge <cedd.bu...@nhs.net> wrote: > Hi. > > I have a treeview with links in that navigate to other pages when > clicked. I didn't want these to cause toggling when they were clicked. > My lists are prerendered. I didn't find a very good way to do this, > but the following works, any better ways to do this would be > appreciated. > > This function goes in the head, it is to stop the event bubbling up to > the default treeviewcode. > > function lihyperlinkclick(e) > { > location.href = '...'; > if (!e) var e = window.event > // handle event > e.cancelBubble = true; > if (e.stopPropagation) e.stopPropagation(); > > } > > The lists are output someting like this. The z-index is important so > that the element receives the event before the default treeview code. > > <li id="..." class="collapsable lastCollapsable"> > <div id="..." class="hitarea collapsable-hitarea lastCollapsable- > hitarea"> > </div> > <span id=".." > > <a id="..." style="z-index: 100;" onclick="lihyperlinkclick(event);" > href="...">Hyperlink Title</a>