I'm trying to stop the propagation on an event of all the anchors in a div that has a click event attached but only the .click jquery function fire e.stopPropagation();, the .on('click', 'a', function()); don't.
Code example that works, the click on the anchor do not fire the click on the div when clicked
<div class="clickedDiv" data-url="http://myurl.com">
  <a class="clickedA">my link</a>
</div>
<script>
  $('.clickedA').click(function(e) {e.stopPropagation();});
  $('.clickedDiv').click(function(e) {
    var url = $(this).data('url');
    window.location.href = url;
  });
</script>
Code exampe that doesn't work, the click on the anchor fire both click, the anchor itself and the div
<div class="clickedDiv" data-url="http://myurl.com">
  <a class="clickedA">my link</a>
</div>
<script>
  $('.clickedDiv').on('click', 'a', function(e) {e.stopPropagation();});
  $('.clickedDiv').click(function(e) {
    var url = $(this).data('url');
    window.location.href = url;
  });
</script>
 
     
    