I am so proud of me:
$('#schuppen-wrapper,#kirche-wrapper,#openair-wrapper,#andererort-
wrapper').hide();

        var showit = $("#form1 #ort_id option:selected").attr("value");
        switch(showit)
                {
                case "1":
                  $('#schuppen-wrapper').show();
                  break;
                case "2":
                  $('#kirche-wrapper').show();
                  break;
                case "3":
                  $('#openair-wrapper').show();
                  break;
                case "4":
                  $('#andererort-wrapper').show();
                  break;
                }

        $('#form1 #ort_id option').click(
                function () {
                var wrapper = $(this).attr('value');
                
$('#schuppen-wrapper,#kirche-wrapper,#openair-wrapper,#andererort-
wrapper').hide();

                switch(wrapper)
                {
                case "1":
                  $('#schuppen-wrapper').show();
                  break;
                case "2":
                  $('#kirche-wrapper').show();
                  break;
                case "3":
                  $('#openair-wrapper').show();
                  break;
                case "4":
                  $('#andererort-wrapper').show();
                  break;
                }
                return false;
        });

but can be reduced, right?

thx
tlz

On Sep 10, 10:27 pm, tlob <[EMAIL PROTECTED]> wrote:
> the following works pretty well on click:
> $('#form1 #ort_id option').click(
>                 function () {
>                 var wrapper = $(this).attr('value');
>                 
> $('#schuppen-wrapper,#kirche-wrapper,#openair-wrapper,#andererort-
> wrapper').hide();
>                 switch(wrapper){
>                 case "1": $('#schuppen-wrapper').show();  break;
>                 case "2": $('#kirche-wrapper').show(); break;
>                 case "3": $('#openair-wrapper').show(); break;
>                 case "4": $('#andererort-wrapper').show(); break;
>                 }
>                 return false;
>         });
>
> but when the page loads the <option value="1-4" selected="selected">
> should be shown. how can I show the right div, when the page loads?
>
> thank
> tom

Reply via email to