[Solved] Count the number of buttons present inside a div


Many ways:
Javascript: document.querySelectorAll('#maindiv button')

JQuery: $('#maindiv button')

var buttons = document.querySelectorAll('#maindiv button')
console.log(buttons.length)
<div id='maindiv'> <button></button> <button></button> <button></button> <button></button> <button></button> </div>

2

solved Count the number of buttons present inside a div