toggle div fails

toggle div fails

If a visitor on my site selects a value in a selection box, I want it's corresponding div to be displayed.
If the visitor selects an other value, I want to hide the old div and display the new div.

The coding I have so far doesn't work properly.. the first and last select options don't display the div at all, and the second select option only flashes the div.

I hope someone can help me out..

PS: The Option1, Option2 and Option3 values are being pulled from my db, but these values can have other names.
  1. function showonlyone() {
  2. var thechosenone = "."+$('#pgroup').val();
  3. $(thechosenone).show(1).hide(1);
  4. }

  5. <select name="pgroup" id="pgroup" size=3 onchange="javascript:showonlyone();"> 
  6. <option value="Option1">Option1</option>
  7. <option value="Option2">Option2</option>
  8. <option value="Option3">Option3</option>
  9. </select>     

  10. <div class="Option1">text option 1</div>
  11. <div class="Option2" style='display:none;'>text option 2</div>
  12. <div class="Option3" style='display:none;'>text option 3</div>