<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>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.