0

Is this even possible to open drop down list with options of item by click on the in js/jquery? Could You help with this, any advice?

user3608388
  • 59
  • 1
  • 7

1 Answers1

0

Something like this : http://jsfiddle.net/Tkshz/?

If the var X is equal to 0 it means the list is visible so it hides the list. If the var X is equal to 1 it means the list isn't visible so it shows the list. The HTML isn't anything special, just a regular list.

JAVASCRIPT:

var x = 0;

function dropDown(){
    if(x == 0){
        document.getElementById("dropdown").style.display="none";
        x = 1;
    }else{
        document.getElementById("dropdown").style.display="block";
        x = 0;
    }
}

HTML:

<button onclick="dropDown()">Show options</button>
<ul id="dropdown">
    <li><a href="google.com">Option 1</a></li>
    <li><a href="google.com">Option 2</a></li>
    <li><a href="google.com">Option 3</a></li>
    <li><a href="google.com">Option 4</a></li>
</ul>
Muhammed
  • 51
  • 5