Note that there are some explanatory texts on larger screens.

plurals
  1. POclick listerner for div but not link
    primarykey
    data
    text
    <p>I have a click listener on a div and inside the div I have a link with a normal -tag but whenever I click on the link the event is also run. How can I prevent the stuff within the click-listener to run if the click on the link inside the div?</p> <p>HTML:</p> <pre><code>&lt;div class="container item-container" data="skarp-version-av-os-x-10.8.3-slappt"&gt; &lt;div class="item"&gt; &lt;div class="number"&gt; &lt;p class="number-data"&gt;1&lt;/p&gt; &lt;/div&gt; &lt;div class="upvotes btn tooltip-points" points="4" id="90" data-toggle="tooltip" title="" data-original-title="Visar poäng satta de senaste 24 h"&gt; 4 poäng &lt;/div&gt; &lt;div class="item-content"&gt; &lt;a href="http://feeds.idg.se/~r/idg/ETkj/~3/XSuYKgEiumE/skarp-version-av-os-x-1083-slappt" target="_blank" class="item-link fill-div"&gt;Skarp version av OS X 10.8.3 släppt&lt;/a&gt; &lt;span class="item-source"&gt;(feeds.idg.se)&lt;/span&gt; &lt;p class="item-author"&gt;Upplagd av Anonym - &lt;em&gt;2013-03-17 21:07:08&lt;/em&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class="comment"&gt; &lt;i class="icon-comment"&gt;&lt;/i&gt; &lt;a href="http://www.tldr.nu/item/view/skarp-version-av-os-x-10.8.3-slappt#disqus_thread"&gt;0 Comments and 0 Reactions&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Javascript:</p> <pre><code>$('.item-container').click(function(event) { var url = $(this).attr('data') ? $(this).attr('data') : ''; if(url != '') window.location = getBaseURL() + 'item/view/' + url; }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload