I think you need an event handler that determines which element triggered the click - something like this
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $(function() { $("#links").click(handler); }) function handler(event) { var $target = $(event.target); if($target.is("#links")) { window.location = "divlocation.htm" } } </script> </head> <body> <div id="links" style="background: yellow"> <a href="test1.htm">link 1</a><br> <a href="test2.htm">link 2</a> </div> </body> </html>
source share