Trying to show/hide things with a <select> menu
I have a <select> menu for my support tickets that asks you what your issue is. Depending on what you pick, it is supposed to display a form related to that issue. For example, if you choose "Report a Bug" the bug report form should be displayed. Well, I cannot get it to work. Here is what I have:
The page links to an external JavaScript file that has this in it:
- $(document).ready(function() {
- $('div.hidden').hide();
- });
And this is the code in question:
- <script type="text/javascript">
- ("#showhide_form").change(function() {
- $("#" + $(this).val()).show();
- });
- </script>
- ...
- <body>
- <strong>What do you want to do?</strong>
- <form name="ticket_menu">
- <select name="ticket_type" id="showhide_form">
- <option value=""></option>
- <option value="player_report">Report a Player</option>
- <option value="bug_report">Report a Bug</option>
- <option value="mistake_report">Report a Mistake</option>
- <option value="feedback">Give Feedback</option>
- <option value="other">Something Else</option>
- </select>
- </form>
- <br /><br /><div class="hidden" id="player_report">player report form code will go here</div>
- <br /><br /><div class="hidden" id="bug_report">bug report form code will go here</div>
- <br /><br /><div class="hidden" id="mistake_report">mistake report form code will go here</div>
- <br /><br /><div class="hidden" id="feedback">feedback form code will go here</div>
- <br /><br /><div class="hidden" id="other">other form code will go here</div>
- </body>