How to stop an anchor from redirecting using JQuery
<p>How i can stop an anchor to redirecting to another page if the user is not login . i have a function to check if the user is login or not. i want to do it with JQuery or javacript have tried so far but with no results.</p>

<pre><code>if (!is_user_logged_in() ) {
     $id = 'yes';
 } else{
     $id = 'no';
}


&lt;a href="&lt;?php bloginfo('url') ?&gt;/profile/?id=&lt;?php echo $qr-&gt;id ?&gt;&amp;search=yes" id="&lt;?php echo $id; ?&gt;"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;

&lt;script type="text/javascript"&gt;
$(document).ready(function(){
  $('a').click(function(){
var id = $(this).attr('id');
 if(id == 'yes'){
  //i want to prevent
}else{
//redirect
}
});
});
&lt;/script&gt;
</code></pre>

<p>please help</p>
