title: Convert attribute into string
body: <p>I know this is really basic javascript but I'm really not so familiar with javascript.</p>
  
  <p>What I'm trying here is to add prettyPhoto arguments where I want to be. First I get href attribute from link, then I convert it to string, then I take last 4 letters to check is it link to image or to some HTML page. And this code works fine but still my Firebug sends me an error: </p>
  
  <p>TypeError: <strong>$hrefy</strong> is undefined</p>
  
  <pre><code>txt = $hrefy.toString(); 
  </code></pre>
  
  <p>How script can work if $hrefy is not defined and how to define it well. This error blocks only javascript code for filtering my portfolio, while other js work fine. </p>
  
  <pre><code>$(document).ready(function(){
  $("a[data-rel^='prettyPhoto']").prettyPhoto();
  
  $hrefy = $("article a").has('img').attr("href");
  txt = $hrefy.toString();
  var lastChar = txt.substr(txt.length - 4);
  if (lastChar=='.jpg') {
      $('article a').has('img').attr('data-rel', 'prettyPhoto'); 
  }
  
  $('a img').click(function () {  
      var desc = $(this).attr('title');  
      $('a').has('img').attr('title', desc);  
  });  
  </code></pre>
  
  <p>});</p>