Click here to Skip to main content
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 Mika Wendelius 236
1 Peter Leow 160
2 Abhinav S 155
3 Kornfeld Eliyahu Peter 115
4 Sergey Alexandrovich Kryukov 115
0 Sergey Alexandrovich Kryukov 8,593
1 OriginalGriff 6,536
2 Peter Leow 3,727
3 Zoltán Zörgő 3,436
4 Richard MacCutchan 2,417


Advertise | Privacy | Mobile
Web04 | 2.8.150123.1 | 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