views:

23

answers:

1

I'm halfway to getting this correct, but i am currently stuck. Firstly i would like the label and dropdown to be hidden be default. This i have achieved using css:

unis

{ visibility:hidden; }

The bit i am slightly stuck on is how to group the items, i have used:

<div class='row'>
                    <div id = "unis">
                        <label id='Universitylbl' for='University'>University institution:</label>
                        <select name="uni">
                            <option value="uni1">uni1</option>
                            <option value="uni2">uni2</option>
                            <option value="uni3">uni3</option>
                            <option value="uni4">uni4</option>
                            <option value="uni5">uni5</option>
                        </select><br />
                    </div>
                </div>

and the javascript to toggle the visibility:

function toggle(elementID){
    var target1 = document.getElementById(elementID)
    if (target1.style.display == 'none') {
        target1.style.display = 'block'
    }
    else
         {
        target1.style.display = 'none'
    }
}

but the above code doesn't appear to work?

A: 

It seems you are assigning target2 a value and altering the display of target1. Shouldn't that be the same object ? (target, for example ?)

Luzal
ignore that, thats just me deleting some code to put up here
Tom
I just tested your code and it works fine. Can I see how you invoke it ?
Luzal