0

I've used $('#dropMenu').click(false); for one of my div#dropMenu so that clicking on it won't do anything.

Inside the div#dropMenu, I've some other elements as

<div id="dropMenu" class="dropDwn hide">
    <ul>
        <li><a class="userLink" href="link.php">Edit Profile</a></li>
        <li><a class="userLink" href="link2.php">Change Password</a></li>
        <li><a class="userLink" href="logout.php">Logout</a></li>
    </ul>
</div>

and I want to be able to click on the link.

(I think) since I've used $('#dropMenu').click(false);, the links are not working.

How do I enable clicking on the links a.userLink?

ptamzz
  • 8,567
  • 30
  • 87
  • 138
  • 1
    Why would you need to specify `dont do anything` on your element when by default things dont do anything with clicks? – Tejs Aug 22 '11 at 17:53
  • 1
    http://stackoverflow.com/questions/209029/best-way-to-remove-an-event-handler-in-jquery – js1568 Aug 22 '11 at 17:54
  • The links have href set so they will work as a normal link and redirect accordingly. – ShankarSangoli Aug 22 '11 at 17:56
  • @Tejs, this div is a pop up. I needed to hide this div when the user clicks outside it, but not inside it. Hence, Im using `$(document).one('click', function(){ $('#dropMenu').hide(); });` – ptamzz Aug 22 '11 at 17:57
  • You are correct, since you have disabled clicking for the parent, the children are not clickable. What was the reasoning behind making the parent div unclickable? Maybe there is another solution for that so you can allow your children to stay clickable? – box86rowh Aug 22 '11 at 17:56

1 Answers1

2

If you want to unbind an event handler use this: $('#dropMenu').unbind('click');

js1568
  • 6,800
  • 2
  • 23
  • 46