title: Stop redirecting in javascript
body: <p>Hi am developing a webpart which is included in sharepoint app and I need to stop redirection in some cases. But it doesn't work, i am trying to use </p>
  
  <pre><code>$('a').click(function(event){
                  event.preventDefault();
                  event.stopImmediatePropagation();
                  return false;
              });
  </code></pre>
  
  <p>it executes and anyway redirection is done. How can I break it?</p>
  
  <p>Purpose of it is: when user change sth on page I need to ask if he wants to proceed or not and then stop any redirection from othe links he might clicked.</p>
  
  <p>Edit:
  I just checked and with regular a with links inside it works but the problem is with link like this:</p>
  
  <pre><code>&lt;a title="Delivery And Technology" class="ms-cui-ctl-large" id="someId" role="button" onclick="return false;" href="javascript:;" unselectable="on" mscui:controltype="" jQuery182001210093900916337="93"&gt;
  </code></pre>
  
  <p>which has inside this html</p>
  
  <pre><code>&lt;SPAN class=ms-cui-ctl-largeIconContainer unselectable="on"&gt;&lt;SPAN class=" ms-cui-img-32by32 ms-cui-img-cont-float ms-cui-imageDisabled" unselectable="on"&gt;&lt;IMG style="TOP: -96px; LEFT: -160px" alt="Delivery And Technology" src="/_layouts/1033/images/ps32x32.png" unselectable="on"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=ms-cui-ctl-largelabel unselectable="on"&gt;Delivery And&lt;BR&gt;Technology&lt;/SPAN&gt;
  </code></pre>
  
  <p>so seems that when I click on this java script recognize it and redirects me so what i want to achive is to detect it and stop before it will redirect me to other page.</p>