title: How to check anchor tag with element if it has another element?
body: <p>Im new to programming , would like to know how to check an A tag that has element inside</p>
  
  <p>I have this example.</p>
  
  <pre><code>&lt;a href="index.html" star='moon' elem='sample_elem' &lt;/a&gt;
  &lt;a href="index.html" month='element' email='sample elem' &lt;/a&gt;
  &lt;a href="index.html" star='moon' elem='sample_elem' &lt;/a&gt;
  </code></pre>
  
  <p>I wanted to check if each 'a' tag with star element has elem element.</p>
  
  <p>Tried this.</p>
  
  <pre><code>if($('a[star]').attr('elem') === undefined){
  alert('star has no elem')
  }else{
  alert('all star has elem')
  }
  //it gives me 'star has no elem'
  </code></pre>
  
  <p>is it possible ?</p>
  
  <p>note : wanted this to be if else statement.</p>