title: How to open data-url on modal clicking by anchor?
body: <p>Actually it's opening after second click but I want to open it first click I guess it can be possible with jquery event. so why I added <code>data-target</code> and data-toggle with jquery ? because if my <code>data-title</code> is <code>blank</code> I will open my link on new tab but if my <code>data-title</code> is pop than I wil open it with bootstrap modal that's why I'm trying to add with jquery.</p>
  
  <p><a href="https://codepen.io/cowardguy/pen/EmVvJj" rel="nofollow noreferrer">please click to see on codepen</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).on("click", "a[data-title]", function() {
  
    var target = $(this).data("title");
  
    var targetLink = $(this).attr("href");
    if (target == "pop") {
      $(this).attr({
        'data-target': '#carouselModal',
        'data-toggle': 'modal',
      });
      return false;
    } else if (target == "blank") {
      window.open(targetLink, '_blank');
      return false;
    } else {
  
    }
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" /&gt;
  
  &lt;div class="container"&gt;
  
  
    &lt;div id="carousel-example-generic" class="carousel slide" data-ride="carousel"&gt;
      &lt;!-- Indicators --&gt;
      &lt;ol class="carousel-indicators"&gt;
        &lt;li data-target="#carousel-example-generic" data-slide-to="0" class="active"&gt;&lt;/li&gt;
        &lt;li data-target="#carousel-example-generic" data-slide-to="1"&gt;&lt;/li&gt;
        &lt;li data-target="#carousel-example-generic" data-slide-to="2"&gt;&lt;/li&gt;
      &lt;/ol&gt;
  
      &lt;!-- Wrapper for slides --&gt;
      &lt;div class="carousel-inner" role="listbox"&gt;
        &lt;div class="item active"&gt;
          &lt;a href="http://www.anitur.com.tr/popup/test-8-content" data-title="pop"&gt;&lt;img src="https://unsplash.it/1400/600?image=114"&gt;&lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="item"&gt;
          &lt;a href="http://www.anitur.com.tr/popup/test-5-us"&gt;&lt;img src="https://unsplash.it/1400/600?image=315" data-title="blank"&gt;&lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="item"&gt;
          &lt;a href="http://www.anitur.com.tr/popup/test-2-posts" data-title="pop"&gt;&lt;img src="https://unsplash.it/1400/600?image=622"&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- Controls --&gt;
      &lt;a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"&gt;
        &lt;span class="glyphicon glyphicon-chevron-left" aria-hidden="true"&gt;&lt;/span&gt;
        &lt;span class="sr-only"&gt;Previous&lt;/span&gt;
      &lt;/a&gt;
      &lt;a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"&gt;
        &lt;span class="glyphicon glyphicon-chevron-right" aria-hidden="true"&gt;&lt;/span&gt;
        &lt;span class="sr-only"&gt;Next&lt;/span&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;div class="modal fade" id="carouselModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;span class="sr-only"&gt;Kapat&lt;/span&gt;&lt;/button&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;!-- carousel modal--&gt;
  
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>