title: How do I check for empty attr() in jquery?
body: <p>I have a few divs that are created using PHP. The anchor within the div always has a HREF, even if it is blank. Basically, I am trying to detect if the HREF is blank. If it has content, do nothing, if it's blank, strip the text out, delete the anchor, them put the text back in.</p>
  
  <p>Here is the div:</p>
  
  <pre><code>&lt;div class="title"&gt; 
      &lt;a class="article" href=""&gt;Lorem Ipsum&lt;/a&gt; 
  &lt;/div&gt; 
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>jQuery(document).ready(function($) { //required for $ to work in Wordpress
  
      $(".article").each(function(){
          if ($(this).attr('href') !== undefined) {
              return;
          } else {
              var linkTitle = $(this).html();
              $(this).parent().empty().html(linkTitle);
          }                               
      });    
  //--&gt;
  });
  </code></pre>