Hi All,

As per this previous post I made

http://tinyurl.com/27gaty

I have cracked on and started to develop a drill down style menu:

I have also uploaded a cut down version of what I am trying to do at
this link:

http://rafb.net/p/KfZAdp80.html

Essentially what I am trying to do is as follows:

1. Adding items to the parent menu

When a user clicks on a menu item from the bottom menu, it should add
it to the top menu and bold it.

That all works fine.

In addition to this I would like to be able to disable the
clickability of the menu item if it is the last item in the menu. If
subsequent items are added below it then the menu item should become
clickable

Below is the funciton I have started on

function addMarketToParent(id, name, root_level) {

  // remove all the MENU_BOLD classes from all the li links in the
parent nav and activate all the onClicks
  $("#parentmenu > ul > li > a ").removeClass("menu_bold");

  // append the market to the parent nav
  $("#parentmenu > ul").append(
    "<li><a href='#' id='market" + id + "' onClick='return
removeMarketFromParent(\"" + id + "\");' >" + name + "</li>"
  );

  // disable onClick and add MENU_BOLD class
  $("#market" + id ).addClass("menu_bold");

}

2.  Removing items from the parent menu

When a user clicks an item from the parent menu it should remove it
from the menu.

That all works fine.

What I would like to be able to do it is, if a user clicks on a menu
item that is further up the tree, then it should remove the item as
well as recurse down the list and remove all those items as well.

Below is the funciton I have started on

function removeMarketFromParent(id){
  // now remove the menus and recursively remove any below this
  $("#market" + id).remove();

}

I look forward to your responses.

Kind regards,

Luke Byrne

Reply via email to