CodeIgniter Forums
[Solved] jQuery DropDown Menu Trigger Event - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [Solved] jQuery DropDown Menu Trigger Event (/showthread.php?tid=22344)



[Solved] jQuery DropDown Menu Trigger Event - El Forum - 09-05-2009

[eluser]RaZoR LeGaCy[/eluser]
What I would like to do is lets say that we have 5 drop down menus right after the next. If the user selects option 2 from the first menu, I want all other menus to disappear/hide.

May be something simple but I am a total newbie in jQuery and Javascript. I know that I can simply add a css class that would inject into the menu divs and add class hideMenu but I am unsure how to write it.

Thank you.



Figured it out!!

Javascript
Code:
$(function() {

    $("#menuItem").change(function()
    {
        switch ($(this).val())
        {
            case '1':
        $("#disabledItem").attr("disabled","disabled");
            break;

            default:
        $("#disabledItem").removeAttr("disabled");
        }


    });
});

HTML
Code:
Menu Box in Html with id="menuItem"


Then textbox, checkbox etc with id's equal to disabledItem