disable the click event for all links except the links in a div

advertisements

I have a page with some links inside a div and some outside that div.

  <div id="navigation">
     <ul>
       <li>
         <a href="/Home/Index">Home</a></li>
      <li>
         <a href="/Home/contactus">Contact Us</a></li>
    </ul>
   </div>
<a href="/User/SignIn">Sign In</a>......

I need to disable the click event for the all the links except inside the navigation div.

How to do it in jquery using similar to:

//disable Click event for links
    $("a:not([id])").live('click', function(e) {
        e.preventDefault;
        return false;
    });


After a try, the below implementation worked:

 //disable Click event for links except navigation
    $("a:not(#navigation a)").live('click', function(e) {
        e.preventDefault;
        return false;
    });

Any flaws in this