I want know how can I pass id by variable is it possible or I have get every button id separately ? Also I want to know how can implement onClick color changing one button at single time rest should have color prop of none.
const btn = document.getElementById('1');
btn.addEventListener('click', function hadleclick() {
btn.style.background = '#53E247';
})
<form>
<div><button id="1">1</button></div>
<div><button id="2">2</button></div>
<div><button id="3">3</button></div>
<div><button id="4">4</button></div>
<div><button id="5">5</button></div>
<div><button id="6">6</button></div>
<div><button id="7">7</button></div>
<div><button id="8">8</button></div>
<div><button id="9">9</button></div>
<input type="submit" class="submit" value="Submit" onclick="subFunc()">
</form>