Clickable LI overrules links within the LI

Posted by Kenneth B on Stack Overflow See other posts from Stack Overflow or by Kenneth B
Published on 2010-04-13T07:13:51Z Indexed on 2010/04/13 7:22 UTC
Read the original article Hit count: 608

Filed under:
|
|

Hello guys and gals...

I have a LI with some information, including some links. I would like jQuery to make the LI clickable, but also remain the links in the LI.

The Clickable part works. I just need the links within to work as well.
NOTE: They work if you right click and choose "Open in new tab".

HTML

<ul id="onskeliste">
    <li url="http://www.dr.dk">Some info with links <a href="http://www.imerco.dk" target="_blank">Imerco</a></a>
</ul>


jQuery

$(document).ready(function() {
 $("#onskeliste li").click(
 function()
 {
  window.location = $(this).attr("url");
  return false;
 });

})(jQuery);

I've found a simular question here, but it doesn't seem to solve my problem. http://stackoverflow.com/questions/180211/jquery-div-click-with-anchors

Can you help me?? :-)

Thank you in advance...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript