![]() |
Hide Dropdowns from each other with if statement??? - 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: Hide Dropdowns from each other with if statement??? (/showthread.php?tid=11049) |
Hide Dropdowns from each other with if statement??? - El Forum - 08-24-2008 [eluser]Nummero2[/eluser] Hi, i´ve got a create form which sents data to a mysql table. In this form I´ve got two dropdown menues. Is it possible to make one of them invisible if a certain value is selected in the other one? Example: Dropdown 1 values: no value, one, two, three; Dropdown 2 values: no value, 99, 88, 77; So I want to achieve that when the user selects a value in Dropdown 1 like "one" the Dropdown 2 is hiding automatically or doesn´t allow an entry at least. With Dropdown 2 vice versa. Hoping for your great ideas as always :-) Greetings Sebastian Hide Dropdowns from each other with if statement??? - El Forum - 08-24-2008 [eluser]xwero[/eluser] That is simple code with jQuery Code: $('#dropdown1, #dropdown2').click(function(){ // catch click event for the two dropdowns Hide Dropdowns from each other with if statement??? - El Forum - 09-04-2008 [eluser]Nummero2[/eluser] Thank you for your answer. My Problem is that I have different DOM Ids for my dropdowns. Id Dropdown1: todo_id Id Dropdown2: project_id (looked with firebug) For todo_id it looks like this "inspected": Code: select id="todo_id" name="todo_id"> For project_id its the same with different values. Now what I want is when a user selects a different entry from value="0" no task in any of the two dropdowns the other one should hide. Here´s the code I tried: Code: $('#todo_id, #project_id').click(function(){ // catch click event for the two dropdowns Doesn´t work :-( Hide Dropdowns from each other with if statement??? - El Forum - 09-05-2008 [eluser]Nummero2[/eluser] friendly push :-) Hide Dropdowns from each other with if statement??? - El Forum - 09-05-2008 [eluser]Randy Casburn[/eluser] disclaimer - I don't know jQuery all that well. Code: $('#todo_id, #project_id').click(function(){ // catch click event for the two dropdowns Try? [edit] I change the dropdown DOM ids so they are correct now. |