CyberShot Posted December 16, 2009 Share Posted December 16, 2009 I am using this code in my site and it works fine. But I have been trying to figure out how to use it in a unordered list instead of a select box. The reason is that I want to be able to change the look of the select box and you can't do that. I like this code because you can add new options without having to modify the jquery code to find those new values. can you figure out how to make this work with an unordered list? <script type="text/javascript"> $(document).ready(function(){ $('.box1').hide(); $('.box2').hide(); $('.box3').hide(); $(".thechoices").change(function(){ $("." + this.value).show().siblings().hide(); }); $(".thechoices").change(); }); </script> </head> <body> <select class="thechoices"> <option value="box1">Box 1</option> <option value="box2">Box 2</option> <option value="box3">Box 3</option> </select> <!-- the DIVs --> <div class="boxes"> <div class="box1"><p>Box 1 stuff...</p></div> <div class="box2"><p>Box 2 stuff...</p></div> <div class="box3"><p>Box 3 stuff...</p></div> </div> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.