Click here to Skip to main content
11,408,835 members (64,257 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript jQuery
Hi
can you please tell me how to add click event on menu option ..
function onMenuClick()
{
    if (menuShown)
    {
//      hideMenu();
        document.getElementById('menu').style.display = 'none';
    }
 
    else
    {
//      showMenu();
        document.getElementById('menu').style.display = 'block';
    }
    menuShown = !menuShown;
}
in body*************
<div id='menu'> 
<ul> 
<li>Menu option 1</li> 
<li>Menu option 2</li> 
<li>Menu option 3</li> 
</ul> 
</div>
Posted 6-Oct-12 13:39pm
Edited 6-Oct-12 20:38pm
v3
Comments
ravi1989h at 6-Oct-12 21:44pm
   
</div>

<div id='menu'>
<ul>
<li>Menu option 1</li>
<li>Menu option 2</li>
<li>Menu option 3</li>
</ul>
</div>
Thilina Chandima at 6-Oct-12 22:40pm
   
your question not clear with your sample code.. so please describe your problem more
ravi1989h at 6-Oct-12 23:25pm
   
i got answer ,thanks for help

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

i got answer ,thanks for help
OP posted, he found the answer. Posting it to pop it out of unanswered list.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 320
2 Maciej Los 155
3 Peter Leow 140
4 Dave Kreskowiak 115
0 Sergey Alexandrovich Kryukov 8,676
1 OriginalGriff 6,855
2 Maciej Los 3,322
3 Abhinav S 3,238
4 Peter Leow 3,034


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 7 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100