Skip to content
Advertisement

Adding Buttons to a Table created dynamically in vue.js

I am trying to dynamically create buttons which are displayed in the 5th (last) column of a table, which is also created dynamically. Everything is created properly. However, upon clicking the buttons, the function is not triggered. Perhaps it is because I am using vue.js to develop my front-end. I have tried using “v-on:click” instead of “click” in the button.setAttribute('click', 'claim()') code below, but this did not help.

JavaScript

Advertisement

Answer

You need to use addEventListener for adding any event. Example : button.addEventListener('click', purchase)

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement