Please, help. How can I set the different data attribute to the elements, which creating by js with using forEach?
const buttons = ['%', 'C', 'DEL', '÷', '1', '2', '3', '*', '4', '5', '6', '+', '7', '8', '9', '-', '.', '0', '='];
buttons.forEach(button => {
const btn = document.createElement('button');
btn.innerHTML = button;
fragment.appendChild(btn);
});
in the end I should get
<button data-all-clear class="span-two">AC</button>
<button data-delete>DEL</button>
<button data-operation>÷</button>
<button data-number>1</button>
<button data-number>2</button>
How can it possible?