Skip to content
Advertisement

Toggle icon class across all the rows in the table

In this javascript code below there are two icons. fa-circle-pause and fa-circle-play.

When a user clicks the play icon in any one of the rows in the table, it is updated with the icon fa-circle-pause. I have been able to do that for the single rows.

But I am not able to update the rest of the rows in the table with the icon fa-circle-play.

How can I do that using just the javascript?

JavaScript
JavaScript

Advertisement

Answer

Simply iterate through all the buttons of the table. While looping, check to see if it’s the button we clicked on, if it isn’t we can change the class accordingly.

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