$(function() { $('#colorselector').change(function(){ $('.colors').hide(); $('#' + $(this).val()).show(); }); });
<div> <ul id="colorselector"> <li class="init">[SELECT]</li> <li value="red">Red</li> <li value="yellow">Yellow</li> <li value="blue">Blue</li> </ul> <div id="red" class="colors" style="display:none"> red... </div> <div id="yellow" class="colors" style="display:none"> yellow.. </div> <div id="blue" class="colors" style="display:none"> blue.. </div> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)