title: How to Disable Download link after 2 clicks on it?
body: <p>I am facing issue in disabling download link after 2 clicks on it. Disable functionality is working properly but with a problem as mentioned below</p>
  
  <ul>
  <li>If disable is working on 2 clicks, file download stops which is using PHP</li>
  <li>If download works, disable is not working</li>
  </ul>
  
  <p>Its either or situation for me. I am placing my code below.</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>var preventClick = false;
  var howMany = 1;
  $('.ThisLink').click(function(e) {
    howMany += 1;
    if (howMany == 3) {
      $(this)
        .css('cursor', 'default')
        .css('text-decoration', 'none')
    }
    /*if (!preventClick) {
        $(this).html($(this).html() + ' lalala');
    }
  
    preventClick = true;*/
  
    return false;
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://code.jquery.com/jquery-1.12.4.min.js"&gt;&lt;/script&gt;
  &lt;table id="datatable" class="table table-striped table-bordered"&gt;
     &lt;thead&gt;
        &lt;tr&gt;
           &lt;th&gt;#&lt;/th&gt;
           &lt;th&gt;Report&lt;/th&gt;
           &lt;th&gt;Action&lt;/th&gt;
        &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
        &lt;?php  
           $x = 1;
           
            foreach ($h-&gt;result() as $row)  
           
            {  $ids = explode(',',$row-&gt;report);
           
               $temp =  sizeof($ids);
           
               for($i =0; $i &lt; $temp ; $i++)
               { ?&gt;
        &lt;tr&gt;
           &lt;td&gt;
              &lt;?php echo $x++;?&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;?php echo $ids[$i];?&gt;
           &lt;/td&gt;
           &lt;td&gt;
              &lt;!-- &lt;?php echo base_url()?&gt;uploadFiles/&lt;?php echo $ids[$i]; ?&gt; --&gt;
              &lt;a href="&lt;?php echo base_url()?&gt;uploadFiles/&lt;?php echo $ids[$i]; ?&gt;?&gt;" target="_blank" class="btn btn-info ThisLink" download&gt;Download&lt;/a&gt;
              &lt;!-- &lt;button id="my_button"&gt;Click Here&lt;/button&gt; --&gt;
           &lt;/td&gt;
           &lt;?php } ?&gt;
        &lt;/tr&gt;
        &lt;?php }  
           ?&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>