title: How do I disable a href link in JavaScript?
body: <p>I have a tag <code>&lt;a href="#"&gt; Previous &lt;/a&gt; 1 2 3 4 &lt;a href="#"&gt; Next &lt;/a&gt;</code> and in some conditions I want this tag to be completely disabled.</p>
  
  <p><em>Code from comments (this is how the link is generated)</em></p>
  
  <pre><code>if (n_index != n_pages) 
      a = a+'&lt;li&gt;&lt;a href="#" onclick="javascript:paginateAjaxPage('+(n_index+1) +','+stype+');"&gt;&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#" onclick="javascript:paginateAjaxPage('+n_pages+','+stype+');" &gt;&gt;&gt;&lt;/a&gt;&lt;/li&gt;'; 
  else 
      a = a+'&lt;li&gt;&lt;a style="cursor: pointer;" onclick="return false;"&gt;&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a style="cursor: pointer;" onclick="return false" &gt;&gt;&gt;&lt;/a&gt;&lt;/li&gt;'; 
  a = a+'&lt;/ul&gt;&lt;/div&gt;';
  </code></pre>