Why does my if condition prevent either clause from executing?
<p>I'm trying to re-write the URLs of a set of links that I select using a jQuery class selector. However, I only wish to re-write the links that don't already have a <em>href</em> attribute specified, so I put in an if/else construct to check for this... However, it's not working. It does work without the if else statement so I'm pretty sure that is where I screwed up. I'm new to both JavaScript and jQuery so sorry if my question is elementary and/or overly obvious.</p>

<pre><code>   var url = window.location;
   var barTwitter = $("a.shareTwitter").attr('href');
   if (barTwitter).val() == "null") {
   $("a.barTwitter").attr('href','http://www.twitter.com/home?status='+ url +'');
     } else {
   $("a.barTwitter").attr('href',barTwitter);
   }
</code></pre>
