<form name="my-form">
  <div class="article">Article</div>
  <div class="long article">Long article</div>
</form>

<script>
  // name أوجد حسب السمة
  let form = document.getElementsByName('my-form')[0];

  // أوجد حسب الصنف داخل النموذج
  let articles = form.getElementsByClassName('article');
  alert(articles.length); // 2 - "article" وجدنا عنصران لهما الصنف
</script>
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.