title: Count number of divs by id within a specified div - js
body: <p>Below is the div structure. How can I find the number of divs which has the id of <code>_1item</code> only inside <code>categoryFurniture</code> in javascript?</p>
  
  <p>I tried this by doing some google research but no luck.</p>
  
  <pre><code>document.querySelectorAll('[id^=_1item]').length
  </code></pre>
  
  <p>div structure example:</p>
  
  <pre><code>&lt;div id="categoryFurniture"&gt;
     &lt;div id= "xyz_1item"&gt;&lt;/div&gt;
     &lt;div id= "abc_1item"&gt;&lt;/div&gt;
     &lt;div id= "xyz_2item"&gt;&lt;/div&gt;
     &lt;div id= "pqr_1item"&gt;&lt;/div&gt;
     &lt;div id= "pqr_2item"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="categoryFruits"&gt;
     &lt;div id= "xyz_1item"&gt;&lt;/div&gt;
     &lt;div id= "abc_2item"&gt;&lt;/div&gt;
     &lt;div id= "xyz_3item"&gt;&lt;/div&gt;
     &lt;div id= "pqr_1item"&gt;&lt;/div&gt;
     &lt;div id= "pqr_3item"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>output should be 3</p>