On a button click, I’d like to get the particular cell value of that row. E.g.: If I click on the age in the first row, then the value I have to get is 50. And if I click on the button in second row, then I should get 94.
How can I get the table cell value on a button click & pass it as a argument to function which is on click?
An event listener always has the clicked element as target and the element, that the listener was bound to as context. long story short, when you click on the table cell, the listener’s context is the cell and hence you have access to the cell content.
Actually by using this code we are getting values on on clicking table row but what i required is on button click and the button is there at the end of each row on clicking the button then it should get the defined values