SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    And your point is.... redgoals's Avatar
    Join Date
    Feb 2002
    Birmingham, UK
    0 Post(s)
    0 Thread(s)

    Unlimited DropDown menus


    I have searched the forum for a similar problem but have been unable to find anything.

    What i am trying to achieve is a dropdown menu which behaves in the following way:

    1, Someone selects an category from the first dropdown menu
    2, if the category has subcategories then dynamically create a new dropdown underneath and in the process fill it with the subcategories from the chosen option in the first menu.
    3, keep doing the above until there are no more subcategories for the chosen option.

    I have a demo setup at

    There is a small bug in the code which does not completely clear all submenus from the page when you go up the chain and select an option from the first menu... follow the below steps to see what i mean:

    1, select "UK Local" from the first dropdown
    2, select "Accountants" from the dynamically created dropdown, a dropdown containing "England, Scotland, Wales, N.Ireland" will appear dynamically
    3, select "UK Online" from the first dropdown

    Now after step 3 you will notice that the dynamically created downdown containing "England, Scotland, Wales, N.Ireland" is still present when it should ideally disappear from the page (it was generated by clicking "UK Local" and is not a sub category list of "UK Online")

    Hopefully someone can understand the above, if i didnt make something entirely clear please ask questions and i will try to explain further.

    will appreciate any replies.

    rg ... my site ... nuff said

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2005
    Michigan, USA
    2 Post(s)
    0 Thread(s)
    What I would look at first is the clearboxes function. Check that
    if(parseInt(x[i].id.substr(4)) > nid)
    is using the expected values.

    Another bug - selecting a menu item then changing that selection to "Please Select" creates the original dropdown again below the current one. Example: after step two in your post, change Accountants to Please Select.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts