title: How to retrieve the attribute for a class
body: <p>I have got a HTML as shown below </p>
  
  <pre><code>&lt;div id="activeui4" class="activateUiHTML" data-role="collapsible"&gt;
      &lt;div class="Topping-and-Crusting-section"&gt;
          &lt;a style="display:block" id="4" vendor_items_id="4" class="btn  btn-sm topp  btn-sm-active" data-count="1"&gt;topping  &lt;span&gt;1&lt;/span&gt;&lt;/a&gt; 
          &lt;a style="display:block" id="4" vendor_items_id="4" class="btn  btn-sm crust " data-count="0"&gt; crust  &lt;span&gt;&lt;/span&gt;&lt;/a&gt;                
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am trying to retrieve the value <code>data-count</code> of class <code>btn  btn-sm topp  btn-sm-active</code></p>
  
  <p>I tried it like this:</p>
  
  <pre><code>var count = $(".activateUiHTML div#"+id_attr_val+".Topping-and-Crusting-section").find(".top").attr('data-count');
  alert(count);
  </code></pre>
  
  <p>But I get back <code>undefined</code>.</p>