How to make N dynamic button clickable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make N dynamic button clickable?

I have created N button dynamically , how to make it clickable so it can perform any other function on click ?

28th Apr 2021, 3:04 AM
Satya Prakash
Satya Prakash - avatar
2 Answers
0
Adjust all N buttons to share the same class name. Afterwards, you can collect their references on page load, and add click event listener for each one.
28th Apr 2021, 3:18 AM
Ipang
0
collect them in an array and iterate the array.
28th Apr 2021, 4:21 AM
Oma Falk
Oma Falk - avatar