user974802
user974802

Reputation: 3457

How to get aside count present inside Section

The above is the HTML

<section id="topping_tsection_57">

   <i id="topping-close"></i>
   <aside>
      <h6 class="tdHeading">Quantity1</h6>
      <img src="images/arrow-topping.png">
      <section class="secclass"><a data-id="57" class="tpActive">Honey with Chocolate Sauce  10 ML</a></section>
      <section class="secclass"><a data-id="57">Honey with Carmel  10 ML</a></section>
      <section class="secclass"><a data-id="57">Strawberry</a></section>
   </aside>

   <aside>
      <h6 class="tdHeading">Quantity2</h6>
      <img src="images/arrow-topping.png">
      <section class="secclass"><a data-id="57" class="tpActive">Honey with Chocolate Sauce  10 ML</a></section>
      <section class="secclass"><a data-id="57">Honey with Carmel  10 ML</a></section>
      <section class="secclass"><a data-id="57">Strawberry</a></section>
   </aside>

  </section>

How to get the total number of aside present under topping_tsection_57

I tried to use the length Or size , but i was getting Uncaught ReferenceError: aside is not defined under console .

i tried it this way .

var id = 57
var n = $("#topping_tsection_"+id+ aside).size();
alert(n);

Could anybody please let me know how to resolve this ??

Upvotes: 1

Views: 83

Answers (1)

andrew
andrew

Reputation: 9583

var aside is undefined. it should be in quotes to make it a string

var n = $("#topping_tsection_"+id+ ' aside').size();

Upvotes: 1

Related Questions