title: jQuery wrap img with anchor
body: <p>Hello I have trying to wrap an image with anchor if class has anchor.</p>
  
  <p>jQuery:</p>
  
  <pre><code>if ( $(".views-row:has(a)").length) {
      var noderef = $(this).attr("anchor");
      $(".views-field-field-teaserbox-fid img").wrap("[anchor = "'+noderef+'" ]");
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;div class="view-content"&gt;
          &lt;div class="views-row"&gt;
  
            &lt;div class="views-field-field-node-ref-nid"&gt;
             &lt;span class="field-content"&gt;&lt;a class="active" href="/all-essentials-inspiring-events"&gt;All the essentials of inspiring events.&lt;/a&gt;&lt;/span&gt;
           &lt;/div&gt;
  
           &lt;div class="views-field-field-teaserbox-fid"&gt;
              &lt;span class="field-content"&gt;&lt;img width="208" height="137" src="http://localhost:8888/sites/default/files/wedding_Giveaway_teaser.jpg?1283880578" alt="" class="imagefield imagefield-field_teaserbox"&gt;&lt;/span&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Also, should I be using a double or single quotes? </p>